TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Typo3DatabaseBackend Class Reference
Inheritance diagram for Typo3DatabaseBackend:
AbstractBackend TaggableBackendInterface BackendInterface BackendInterface

Public Member Functions

 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 set ($entryIdentifier, $data, array $tags=array(), $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 findIdentifiersByTag ($tag)
 
 flush ()
 
 flushByTag ($tag)
 
 collectGarbage ()
 
 getCacheTable ()
 
 getTagsTable ()
 
 setCompression ($compression)
 
 setCompressionLevel ($compressionLevel)
 
 getTableDefinitions ()
 
- Public Member Functions inherited from AbstractBackend
 __construct ($context, array $options=array())
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setDefaultLifetime ($defaultLifetime)
 

Public Attributes

const FAKED_UNLIMITED_EXPIRE = 2145909600
 
- Public Attributes inherited from AbstractBackend
const DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000'
 
const UNLIMITED_LIFETIME = 0
 

Protected Member Functions

 initializeCommonReferences ()
 
 flushByTagDbal ($tag)
 
 collectGarbageDbal ()
 
 throwExceptionIfFrontendDoesNotExist ()
 
- Protected Member Functions inherited from AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

 $cacheTable
 
 $tagsTable
 
 $compression = false
 
 $compressionLevel = -1
 
 $identifierField
 
 $expiresField
 
 $maximumLifetime
 
 $notExpiredStatement
 
 $expiredStatement
 
 $tableList
 
 $tableJoin
 
- Protected Attributes inherited from AbstractBackend
 $cache
 
 $cacheIdentifier
 
 $context
 
 $defaultLifetime = 3600
 

Detailed Description

A caching backend which stores cache entries in database tables

Definition at line 21 of file Typo3DatabaseBackend.php.

Member Function Documentation

collectGarbage ( )

Does garbage collection

Returns
void

Implements BackendInterface.

Definition at line 316 of file Typo3DatabaseBackend.php.

References $GLOBALS, Typo3DatabaseBackend\collectGarbageDbal(), and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

collectGarbageDbal ( )
protected

Does garbage collection for DBAL databases

Returns
void

Definition at line 336 of file Typo3DatabaseBackend.php.

References $GLOBALS.

Referenced by Typo3DatabaseBackend\collectGarbage().

findIdentifiersByTag (   $tag)

Finds and returns all cache entries which are tagged by the specified tag.

Parameters
string$tagThe tag to search for
Returns
array An array with identifiers of all matching entries. An empty array if no entries matched

Implements TaggableBackendInterface.

Definition at line 240 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

flush ( )

Removes all cache entries of this cache.

Returns
void

Implements BackendInterface.

Definition at line 261 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

flushByTag (   $tag)

Removes all cache entries of this cache which are tagged by the specified tag.

Parameters
string$tagThe tag the entries must have
Returns
void

Implements TaggableBackendInterface.

Definition at line 274 of file Typo3DatabaseBackend.php.

References $GLOBALS, Typo3DatabaseBackend\flushByTagDbal(), and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

flushByTagDbal (   $tag)
protected

Removes all cache entries of this cache for DBAL databases which are tagged by the specified tag.

Parameters
string$tagThe tag the entries must have
Returns
void

Definition at line 295 of file Typo3DatabaseBackend.php.

References $GLOBALS.

Referenced by Typo3DatabaseBackend\flushByTag().

get (   $entryIdentifier)

Loads data from a cache file.

Parameters
string$entryIdentifierAn identifier which describes the cache entry to load
Returns
mixed The cache entry's data as a string or FALSE if the cache entry could not be loaded

Implements BackendInterface.

Definition at line 170 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

getCacheTable ( )

Returns the table where the cache entries are stored.

Returns
string The cache table.

Definition at line 358 of file Typo3DatabaseBackend.php.

References Typo3DatabaseBackend\$cacheTable, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

getTableDefinitions ( )

Calculate needed table definitions for this cache. This helper method is used by install tool and extension manager and is not part of the public API!

Returns
string SQL of table definitions

Definition at line 419 of file Typo3DatabaseBackend.php.

getTagsTable ( )

Gets the table where cache tags are stored.

Returns
string Name of the table storing tags

Definition at line 369 of file Typo3DatabaseBackend.php.

References Typo3DatabaseBackend\$tagsTable, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

has (   $entryIdentifier)

Checks if a cache entry with the specified identifier exists.

Parameters
string$entryIdentifierSpecifies the identifier to check for existence
Returns
bool TRUE if such an entry exists, FALSE if not

Implements BackendInterface.

Definition at line 194 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

initializeCommonReferences ( )
protected

Initializes common references used in this backend.

Returns
void

Definition at line 102 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\$tagsTable.

Referenced by Typo3DatabaseBackend\setCache().

remove (   $entryIdentifier)

Removes all cache entries matching the specified identifier. Usually this only affects one entry.

Parameters
string$entryIdentifierSpecifies the cache entry to remove
Returns
bool TRUE if (at least) an entry could be removed or FALSE if no entry was found

Implements BackendInterface.

Definition at line 216 of file Typo3DatabaseBackend.php.

References $GLOBALS, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

set (   $entryIdentifier,
  $data,
array  $tags = array(),
  $lifetime = null 
)

Saves data in a cache file.

Parameters
string$entryIdentifierAn identifier for this specific cache entry
string$dataThe data to be stored
array$tagsTags to associate with this cache entry
int$lifetimeLifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
Returns
void
Exceptions
\TYPO3\CMS\Core\Cache\Exceptionif no cache frontend has been set.
\TYPO3\CMS\Core\Cache\Exception\InvalidDataExceptionif the data to be stored is not a string.

Implements BackendInterface.

Definition at line 124 of file Typo3DatabaseBackend.php.

References AbstractBackend\$defaultLifetime, $GLOBALS, Typo3DatabaseBackend\$maximumLifetime, and Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

Set cache frontend instance and calculate data and tags table name

Parameters
\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface$cacheThe frontend for this backend
Returns
void

Implements BackendInterface.

Definition at line 89 of file Typo3DatabaseBackend.php.

References AbstractBackend\$cacheIdentifier, and Typo3DatabaseBackend\initializeCommonReferences().

setCompression (   $compression)

Enable data compression

Parameters
bool$compressionTRUE to enable compression

Definition at line 380 of file Typo3DatabaseBackend.php.

References Typo3DatabaseBackend\$compression.

setCompressionLevel (   $compressionLevel)

Set data compression level. If compression is enabled and this is not set, gzcompress default level will be used

Parameters
int-1 to 9: Compression level

Definition at line 392 of file Typo3DatabaseBackend.php.

References Typo3DatabaseBackend\$compressionLevel.

throwExceptionIfFrontendDoesNotExist ( )
protected

Member Data Documentation

$cacheTable
protected

Definition at line 30 of file Typo3DatabaseBackend.php.

Referenced by Typo3DatabaseBackend\getCacheTable().

$compression = false
protected

Definition at line 40 of file Typo3DatabaseBackend.php.

Referenced by Typo3DatabaseBackend\setCompression().

$compressionLevel = -1
protected

Definition at line 45 of file Typo3DatabaseBackend.php.

Referenced by Typo3DatabaseBackend\setCompressionLevel().

$expiredStatement
protected

Definition at line 70 of file Typo3DatabaseBackend.php.

$expiresField
protected

Definition at line 55 of file Typo3DatabaseBackend.php.

$identifierField
protected

Definition at line 50 of file Typo3DatabaseBackend.php.

$maximumLifetime
protected

Definition at line 60 of file Typo3DatabaseBackend.php.

Referenced by Typo3DatabaseBackend\set().

$notExpiredStatement
protected

Definition at line 65 of file Typo3DatabaseBackend.php.

$tableJoin
protected

Definition at line 80 of file Typo3DatabaseBackend.php.

$tableList
protected

Definition at line 75 of file Typo3DatabaseBackend.php.

$tagsTable
protected
const FAKED_UNLIMITED_EXPIRE = 2145909600

Definition at line 26 of file Typo3DatabaseBackend.php.