TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend Class Reference
Inheritance diagram for TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend:
TYPO3\CMS\Core\Cache\Backend\AbstractBackend TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface

Public Member Functions

 setCache (FrontendInterface $cache)
 
 set ($entryIdentifier, $data, array $tags=[], $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 TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 __construct ($context, array $options=[])
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setDefaultLifetime ($defaultLifetime)
 

Public Attributes

const FAKED_UNLIMITED_EXPIRE = 2145909600
 
- Public Attributes inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
const DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000'
 
const UNLIMITED_LIFETIME = 0
 

Protected Member Functions

 initializeCommonReferences ()
 
 throwExceptionIfFrontendDoesNotExist ()
 
 isConnectionMysql ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

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

Detailed Description

A caching backend which stores cache entries in database tables

Definition at line 24 of file Typo3DatabaseBackend.php.

Member Function Documentation

◆ collectGarbage()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::collectGarbage ( )

◆ findIdentifiersByTag()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface.

Definition at line 246 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ flush()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::flush ( )

Removes all cache entries of this cache.

Returns
void

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 267 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ flushByTag()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface.

Definition at line 280 of file Typo3DatabaseBackend.php.

References $GLOBALS, TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\isConnectionMysql(), and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ get()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 173 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ getCacheTable()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::getCacheTable ( )

Returns the table where the cache entries are stored.

Returns
string The cache table.

Definition at line 375 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$cacheTable, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ getTableDefinitions()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 436 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath().

◆ getTagsTable()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::getTagsTable ( )

Gets the table where cache tags are stored.

Returns
string Name of the table storing tags

Definition at line 386 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$tagsTable, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ has()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 197 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ initializeCommonReferences()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::initializeCommonReferences ( )
protected

Initializes common references used in this backend.

Returns
void

Definition at line 105 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$tagsTable.

Referenced by TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\setCache().

◆ isConnectionMysql()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::isConnectionMysql ( )
protected

This database backend uses some optimized queries for mysql to get maximum performance.

Returns
bool

Definition at line 457 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded().

Referenced by TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\collectGarbage(), and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\flushByTag().

◆ remove()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 219 of file Typo3DatabaseBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ set()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::set (   $entryIdentifier,
  $data,
array  $tags = [],
  $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

Implements TYPO3\CMS\Core\Cache\Backend\BackendInterface.

Definition at line 127 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$defaultLifetime, $GLOBALS, TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$maximumLifetime, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\throwExceptionIfFrontendDoesNotExist().

◆ setCache()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::setCache ( FrontendInterface  $cache)

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

Definition at line 92 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$cacheIdentifier, and TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\initializeCommonReferences().

◆ setCompression()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::setCompression (   $compression)

Enable data compression

Parameters
bool$compressionTRUE to enable compression

Definition at line 397 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$compression.

◆ setCompressionLevel()

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::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 409 of file Typo3DatabaseBackend.php.

References TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend\$compressionLevel.

◆ throwExceptionIfFrontendDoesNotExist()

Member Data Documentation

◆ $cacheTable

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$cacheTable
protected

◆ $compression

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$compression = false
protected

◆ $compressionLevel

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$compressionLevel = -1
protected

◆ $expiredStatement

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$expiredStatement
protected

Definition at line 73 of file Typo3DatabaseBackend.php.

◆ $expiresField

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$expiresField
protected

Definition at line 58 of file Typo3DatabaseBackend.php.

◆ $identifierField

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$identifierField
protected

Definition at line 53 of file Typo3DatabaseBackend.php.

◆ $maximumLifetime

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$maximumLifetime
protected

◆ $notExpiredStatement

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$notExpiredStatement
protected

Definition at line 68 of file Typo3DatabaseBackend.php.

◆ $tableJoin

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$tableJoin
protected

Definition at line 83 of file Typo3DatabaseBackend.php.

◆ $tableList

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$tableList
protected

Definition at line 78 of file Typo3DatabaseBackend.php.

◆ $tagsTable

TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::$tagsTable
protected

◆ FAKED_UNLIMITED_EXPIRE

const TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::FAKED_UNLIMITED_EXPIRE = 2145909600

Definition at line 29 of file Typo3DatabaseBackend.php.