TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Cache\Backend\PdoBackend Class Reference
Inheritance diagram for TYPO3\CMS\Core\Cache\Backend\PdoBackend:
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

 setDataSourceName ($DSN)
 
 setUsername ($username)
 
 setPassword ($password)
 
 initializeObject ()
 
 set ($entryIdentifier, $data, array $tags=[], $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 flush ()
 
 flushByTag ($tag)
 
 findIdentifiersByTag ($tag)
 
 collectGarbage ()
 
- 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)
 

Protected Member Functions

 getNotExpiredStatement ()
 
 connect ()
 
 createCacheTables ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

 $dataSourceName
 
 $username
 
 $password
 
 $databaseHandle
 
 $pdoDriver
 
- Protected Attributes inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 $cache
 
 $cacheIdentifier
 
 $context
 
 $defaultLifetime = 3600
 

Additional Inherited Members

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

Detailed Description

A PDO database cache backend

Definition at line 21 of file PdoBackend.php.

Member Function Documentation

◆ collectGarbage()

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

Does garbage collection

Returns
void

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

Definition at line 227 of file PdoBackend.php.

References $GLOBALS.

◆ connect()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::connect ( )
protected

◆ createCacheTables()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::createCacheTables ( )
protected

Creates the tables needed for the cache backend.

Returns
void
Exceptions

Definition at line 277 of file PdoBackend.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Core\Database\PdoHelper\importSql().

Referenced by TYPO3\CMS\Core\Cache\Backend\PdoBackend\connect().

◆ findIdentifiersByTag()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::findIdentifiersByTag (   $tag)

Finds and returns all cache entry identifiers 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 214 of file PdoBackend.php.

◆ flush()

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

Removes all cache entries of this cache.

Returns
void

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

Definition at line 183 of file PdoBackend.php.

◆ flushByTag()

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

◆ get()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::get (   $entryIdentifier)

Loads data from the cache.

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

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

Definition at line 138 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\getNotExpiredStatement().

◆ getNotExpiredStatement()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::getNotExpiredStatement ( )
protected

Returns an SQL statement that evaluates to TRUE if the entry is not expired.

Returns
string

Definition at line 240 of file PdoBackend.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Core\Cache\Backend\PdoBackend\get(), and TYPO3\CMS\Core\Cache\Backend\PdoBackend\has().

◆ has()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::has (   $entryIdentifier)

Checks if a cache entry with the specified identifier exists.

Parameters
string$entryIdentifierAn identifier specifying the cache entry
Returns
bool TRUE if such an entry exists, FALSE if not

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

Definition at line 152 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\getNotExpiredStatement().

◆ initializeObject()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::initializeObject ( )

Initialize the cache backend.

Returns
void

Definition at line 89 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\connect().

◆ remove()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::remove (   $entryIdentifier)

Removes all cache entries matching the specified identifier. Usually this only affects one entry but if - for what reason ever - old entries for the identifier still exist, they are removed as well.

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 168 of file PdoBackend.php.

◆ set()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::set (   $entryIdentifier,
  $data,
array  $tags = [],
  $lifetime = null 
)

Saves data in the cache.

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 107 of file PdoBackend.php.

References $GLOBALS.

◆ setDataSourceName()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::setDataSourceName (   $DSN)

Sets the DSN to use

Parameters
string$DSNThe DSN to use for connecting to the DB
Returns
void

Definition at line 55 of file PdoBackend.php.

◆ setPassword()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::setPassword (   $password)

Sets the password to use

Parameters
string$passwordThe password to use for connecting to the DB
Returns
void

Definition at line 79 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\$password.

◆ setUsername()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::setUsername (   $username)

Sets the username to use

Parameters
string$usernameThe username to use for connecting to the DB
Returns
void

Definition at line 67 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\$username.

Member Data Documentation

◆ $databaseHandle

TYPO3\CMS\Core\Cache\Backend\PdoBackend::$databaseHandle
protected

Definition at line 41 of file PdoBackend.php.

◆ $dataSourceName

TYPO3\CMS\Core\Cache\Backend\PdoBackend::$dataSourceName
protected

Definition at line 26 of file PdoBackend.php.

◆ $password

TYPO3\CMS\Core\Cache\Backend\PdoBackend::$password
protected

Definition at line 36 of file PdoBackend.php.

Referenced by TYPO3\CMS\Core\Cache\Backend\PdoBackend\setPassword().

◆ $pdoDriver

TYPO3\CMS\Core\Cache\Backend\PdoBackend::$pdoDriver
protected

Definition at line 46 of file PdoBackend.php.

◆ $username

TYPO3\CMS\Core\Cache\Backend\PdoBackend::$username
protected

Definition at line 31 of file PdoBackend.php.

Referenced by TYPO3\CMS\Core\Cache\Backend\PdoBackend\setUsername().