TYPO3 CMS  TYPO3_6-2
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 t3lib_cache_backend_DbBackend

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 TYPO3\CMS\Core\Cache\Backend\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 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

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! A caching backend which stores cache entries in database tables

Author
Christian Kuhn lolli.nosp@m.@sch.nosp@m.warzb.nosp@m.u.ch
Ingo Renner ingo@.nosp@m.typo.nosp@m.3.org

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 240 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 260 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 272 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 170 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 365 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 421 of file Typo3DatabaseBackend.php.

◆ 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 375 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
boolean TRUE if such an entry exists, FALSE if not

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

Definition at line 193 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 104 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 441 of file Typo3DatabaseBackend.php.

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
boolean 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 214 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 = 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
integer$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 125 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 ( \TYPO3\CMS\Core\Cache\Frontend\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

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

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
boolean$compressionTRUE to enable compression

Definition at line 385 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
integer-1 to 9: Compression level

Definition at line 396 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.