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

Public Member Functions

 setDataSourceName ($DSN)
 
 setUsername ($username)
 
 setPassword ($password)
 
 initializeObject ()
 
 set ($entryIdentifier, $data, array $tags=array(), $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 flush ()
 
 flushByTag ($tag)
 
 findIdentifiersByTag ($tag)
 
 collectGarbage ()
 
- Public Member Functions inherited from AbstractBackend
 __construct ($context, array $options=array())
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setDefaultLifetime ($defaultLifetime)
 

Protected Member Functions

 getNotExpiredStatement ()
 
 connect ()
 
 createCacheTables ()
 
- Protected Member Functions inherited from AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

 $dataSourceName
 
 $username
 
 $password
 
 $databaseHandle
 
 $pdoDriver
 
- Protected Attributes inherited from AbstractBackend
 $cache
 
 $cacheIdentifier
 
 $context
 
 $defaultLifetime = 3600
 

Additional Inherited Members

- Public Attributes inherited from 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 ( )

Does garbage collection

Returns
void

Implements BackendInterface.

Definition at line 227 of file PdoBackend.php.

References $GLOBALS.

connect ( )
protected

Connect to the database

Returns
void
Exceptions
\RuntimeExceptionif something goes wrong

Definition at line 251 of file PdoBackend.php.

References PdoBackend\createCacheTables().

Referenced by PdoBackend\initializeObject().

createCacheTables ( )
protected

Creates the tables needed for the cache backend.

Returns
void
Exceptions
\RuntimeExceptionif something goes wrong

Definition at line 277 of file PdoBackend.php.

Referenced by PdoBackend\connect().

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 TaggableBackendInterface.

Definition at line 214 of file PdoBackend.php.

flush ( )

Removes all cache entries of this cache.

Returns
void

Implements BackendInterface.

Definition at line 183 of file PdoBackend.php.

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

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 BackendInterface.

Definition at line 138 of file PdoBackend.php.

References PdoBackend\getNotExpiredStatement().

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 PdoBackend\get(), and PdoBackend\has().

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 BackendInterface.

Definition at line 152 of file PdoBackend.php.

References PdoBackend\getNotExpiredStatement().

initializeObject ( )

Initialize the cache backend.

Returns
void

Definition at line 89 of file PdoBackend.php.

References PdoBackend\connect().

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 BackendInterface.

Definition at line 168 of file PdoBackend.php.

set (   $entryIdentifier,
  $data,
array  $tags = array(),
  $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
\TYPO3\CMS\Core\Cache\Exceptionif no cache frontend has been set.
\InvalidArgumentExceptionif the identifier is not valid
\TYPO3\CMS\Core\Cache\Exception\InvalidDataExceptionif $data is not a string

Implements BackendInterface.

Definition at line 107 of file PdoBackend.php.

References $GLOBALS.

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 (   $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 PdoBackend\$password.

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 PdoBackend\$username.

Member Data Documentation

$databaseHandle
protected

Definition at line 41 of file PdoBackend.php.

$dataSourceName
protected

Definition at line 26 of file PdoBackend.php.

$password
protected

Definition at line 36 of file PdoBackend.php.

Referenced by PdoBackend\setPassword().

$pdoDriver
protected

Definition at line 46 of file PdoBackend.php.

$username
protected

Definition at line 31 of file PdoBackend.php.

Referenced by PdoBackend\setUsername().