‪TYPO3CMS  9.5
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)
 
mixed get ($entryIdentifier)
 
bool has ($entryIdentifier)
 
bool remove ($entryIdentifier)
 
 flush ()
 
 flushByTag ($tag)
 
array 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)
 
 flushByTags (array $tags)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\BackendInterface
 setCache (Cache\Frontend\FrontendInterface $cache)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface
 flushByTags (array $tags)
 

Protected Member Functions

string getNotExpiredStatement ()
 
 connect ()
 
 createCacheTables ()
 
 importSql (\PDO $databaseHandle, string $pdoDriver, string $pathAndFilename)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\AbstractBackend
DateTime calculateExpiryTime ($lifetime=null)
 

Protected Attributes

string $dataSourceName
 
string $username
 
string $password
 
PDO $databaseHandle
 
string $pdoDriver
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Cache\Backend\AbstractBackend
TYPO3 CMS Core Cache Frontend FrontendInterface $cache
 
string $cacheIdentifier
 
string $context
 
int $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 26 of file PdoBackend.php.

Member Function Documentation

◆ collectGarbage()

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

Does garbage collection

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

Definition at line 205 of file PdoBackend.php.

References $GLOBALS.

◆ connect()

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

Connect to the database

Exceptions

Definition at line 228 of file PdoBackend.php.

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

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

◆ createCacheTables()

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

Creates the tables needed for the cache backend.

Exceptions

Definition at line 253 of file PdoBackend.php.

References TYPO3\CMS\Core\Utility\ExtensionManagementUtility\extPath(), and TYPO3\CMS\Core\Cache\Backend\PdoBackend\importSql().

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

◆ findIdentifiersByTag()

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

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

Parameters
string$tag‪The 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 195 of file PdoBackend.php.

◆ flush()

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

Removes all cache entries of this cache.

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

Definition at line 167 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$tag‪The tag the entries must have

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

Definition at line 180 of file PdoBackend.php.

◆ get()

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

Loads data from the cache.

Parameters
string$entryIdentifier‪An 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 127 of file PdoBackend.php.

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

◆ getNotExpiredStatement()

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

References $GLOBALS.

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

◆ has()

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

Checks if a cache entry with the specified identifier exists.

Parameters
string$entryIdentifier‪An 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 140 of file PdoBackend.php.

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

◆ importSql()

TYPO3\CMS\Core\Cache\Backend\PdoBackend::importSql ( \PDO  $databaseHandle,
string  $pdoDriver,
string  $pathAndFilename 
)
protected

Pumps the SQL into the database. Use for DDL only.

Important: key definitions with length specifiers (needed for MySQL) must be given as "field"(xyz) - no space between double quote and parenthesis - so they can be removed automatically.

Parameters
\PDO$databaseHandle
string$pdoDriver
string$pathAndFilename

Definition at line 278 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\PdoBackend\$databaseHandle, and TYPO3\CMS\Core\Cache\Backend\PdoBackend\$pdoDriver.

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

◆ initializeObject()

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

Initialize the cache backend.

Definition at line 81 of file PdoBackend.php.

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

◆ remove()

bool 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$entryIdentifier‪Specifies 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 155 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$entryIdentifier‪An identifier for this specific cache entry
string$data‪The data to be stored
array$tags‪Tags to associate with this cache entry
int$lifetime‪Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
Exceptions
Exception‪if no cache frontend has been set.

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

Definition at line 97 of file PdoBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$defaultLifetime, and $GLOBALS.

◆ setDataSourceName()

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

Sets the DSN to use

Parameters
string$DSN‪The DSN to use for connecting to the DB

Definition at line 53 of file PdoBackend.php.

◆ setPassword()

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

Sets the password to use

Parameters
string$password‪The password to use for connecting to the DB

Definition at line 73 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$username‪The username to use for connecting to the DB

Definition at line 63 of file PdoBackend.php.

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

Member Data Documentation

◆ $databaseHandle

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

Definition at line 42 of file PdoBackend.php.

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

◆ $dataSourceName

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

Definition at line 30 of file PdoBackend.php.

◆ $password

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

Definition at line 38 of file PdoBackend.php.

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

◆ $pdoDriver

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

Definition at line 46 of file PdoBackend.php.

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

◆ $username

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

Definition at line 34 of file PdoBackend.php.

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