‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Cache\Backend\FileBackend Class Reference
Inheritance diagram for TYPO3\CMS\Core\Cache\Backend\FileBackend:
TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend TYPO3\CMS\Core\Cache\Backend\FreezableBackendInterface TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface TYPO3\CMS\Core\Cache\Backend\AbstractBackend TYPO3\CMS\Core\Cache\Backend\PhpCapableBackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface TYPO3\CMS\Core\Cache\Backend\BackendInterface

Public Member Functions

 freeze ()
 
bool isFrozen ()
 
 setCache (FrontendInterface $cache)
 
 set ($entryIdentifier, $data, array $tags=[], $lifetime=null)
 
mixed get ($entryIdentifier)
 
bool has ($entryIdentifier)
 
bool remove ($entryIdentifier)
 
array findIdentifiersByTag ($searchedTag)
 
 flush ()
 
 flushByTag ($tag)
 
 collectGarbage ()
 
mixed requireOnce ($entryIdentifier)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend
 setCacheDirectory ($cacheDirectory)
 
string getCacheDirectory ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 __construct ($context, array $options=[])
 
 setDefaultLifetime ($defaultLifetime)
 
 flushByTags (array $tags)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\TaggableBackendInterface
 flushByTags (array $tags)
 

Public Attributes

const SEPARATOR = '^'
 
const EXPIRYTIME_FORMAT = 'YmdHis'
 
const EXPIRYTIME_LENGTH = 14
 
const DATASIZE_DIGITS = 10
 
- ‪Public Attributes inherited from ‪TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend
const SEPARATOR = '^'
 
const EXPIRYTIME_FORMAT = 'YmdHis'
 
const EXPIRYTIME_LENGTH = 14
 
const DATASIZE_DIGITS = 10
 
- ‪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

bool isCacheFileExpired ($cacheEntryPathAndFilename)
 
mixed findCacheFilesByIdentifier ($entryIdentifier)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend
 createFinalCacheDirectory ($finalCacheDirectory)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Core\Cache\Backend\AbstractBackend
DateTime calculateExpiryTime ($lifetime=null)
 

Protected Attributes

string $cacheEntryFileExtension = ''
 
array $cacheEntryIdentifiers = array( )
 
bool $frozen = false
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend
string $cacheDirectory = ''
 
string $temporaryCacheDirectory = ''
 
string $cacheEntryFileExtension = ''
 
array $cacheEntryIdentifiers = array( )
 
bool $frozen = false
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\Cache\Backend\AbstractBackend
FrontendInterface $cache
 
string $cacheIdentifier
 
string $context
 
int $defaultLifetime = 3600
 

Detailed Description

A caching backend which stores cache entries in files

Definition at line 29 of file FileBackend.php.

Member Function Documentation

◆ collectGarbage()

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

Does garbage collection

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 317 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\FileBackend\isCacheFileExpired().

◆ findCacheFilesByIdentifier()

mixed TYPO3\CMS\Core\Cache\Backend\FileBackend::findCacheFilesByIdentifier (   $entryIdentifier)
protected

Tries to find the cache entry for the specified identifier. Usually only one cache entry should be found - if more than one exist, this is due to some error or crash.

Parameters
string$entryIdentifier‪The cache entry identifier
Returns
‪mixed The filenames (including path) as an array if one or more entries could be found, otherwise FALSE

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 345 of file FileBackend.php.

◆ findIdentifiersByTag()

array TYPO3\CMS\Core\Cache\Backend\FileBackend::findIdentifiersByTag (   $searchedTag)

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

Parameters
string$searchedTag‪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 231 of file FileBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\FileBackend\DATASIZE_DIGITS.

Referenced by TYPO3\CMS\Core\Cache\Backend\FileBackend\flushByTag().

◆ flush()

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

Removes all cache entries of this cache and sets the frozen flag to FALSE.

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 267 of file FileBackend.php.

◆ flushByTag()

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

References TYPO3\CMS\Core\Cache\Backend\FileBackend\findIdentifiersByTag().

◆ freeze()

TYPO3\CMS\Core\Cache\Backend\FileBackend::freeze ( )

Freezes this cache backend.

All data in a frozen backend remains unchanged and methods which try to add or modify data result in an exception thrown. Possible expiry times of individual cache entries are ignored.

On the positive side, a frozen cache backend is much faster on read access. A frozen backend can only be thawed by calling the flush() method.

Exceptions

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

Definition at line 61 of file FileBackend.php.

◆ get()

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

Loads data from a cache file.

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
Exceptions

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 167 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\FileBackend\$cacheEntryFileExtension, TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Cache\Backend\FileBackend\DATASIZE_DIGITS, and TYPO3\CMS\Core\Cache\Backend\FileBackend\isCacheFileExpired().

◆ has()

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

Checks if a cache entry with the specified identifier exists.

Parameters
string$entryIdentifier
Returns
‪bool TRUE if such an entry exists, FALSE if not
Exceptions

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 196 of file FileBackend.php.

References TYPO3\CMS\Core\Utility\PathUtility\basename(), and TYPO3\CMS\Core\Cache\Backend\FileBackend\isCacheFileExpired().

◆ isCacheFileExpired()

bool TYPO3\CMS\Core\Cache\Backend\FileBackend::isCacheFileExpired (   $cacheEntryPathAndFilename)
protected

Checks if the given cache entry files are still valid or if their lifetime has exceeded.

Parameters
string$cacheEntryPathAndFilename
Returns
‪bool

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 298 of file FileBackend.php.

References $GLOBALS, and TYPO3\CMS\Core\Cache\Backend\FileBackend\DATASIZE_DIGITS.

Referenced by TYPO3\CMS\Core\Cache\Backend\FileBackend\collectGarbage(), TYPO3\CMS\Core\Cache\Backend\FileBackend\get(), TYPO3\CMS\Core\Cache\Backend\FileBackend\has(), and TYPO3\CMS\Core\Cache\Backend\FileBackend\requireOnce().

◆ isFrozen()

bool TYPO3\CMS\Core\Cache\Backend\FileBackend::isFrozen ( )

Tells if this backend is frozen.

Returns
‪bool

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

Definition at line 88 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\FileBackend\$frozen.

◆ remove()

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

Removes all cache entries matching the specified identifier. Usually this only affects one entry.

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
Exceptions

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 216 of file FileBackend.php.

◆ requireOnce()

mixed TYPO3\CMS\Core\Cache\Backend\FileBackend::requireOnce (   $entryIdentifier)

Loads PHP code from the cache and require_onces it right away.

Parameters
string$entryIdentifier‪An identifier which describes the cache entry to load
Exceptions

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 362 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\FileBackend\$cacheEntryFileExtension, TYPO3\CMS\Core\Utility\PathUtility\basename(), and TYPO3\CMS\Core\Cache\Backend\FileBackend\isCacheFileExpired().

◆ set()

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

Saves data in a cache file.

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

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 123 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\FileBackend\$cacheEntryFileExtension, $GLOBALS, TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Utility\GeneralUtility\fixPermissions(), and TYPO3\CMS\Core\Utility\StringUtility\getUniqueId().

◆ setCache()

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

Sets a reference to the cache frontend which uses this backend and initializes the default cache directory.

This method also detects if this backend is frozen and sets the internal flag accordingly.

Parameters
FrontendInterface$cache‪The cache frontend

Reimplemented from TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend.

Definition at line 102 of file FileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\AbstractBackend\$cache.

Member Data Documentation

◆ $cacheEntryFileExtension

string TYPO3\CMS\Core\Cache\Backend\FileBackend::$cacheEntryFileExtension = ''
protected

◆ $cacheEntryIdentifiers

array TYPO3\CMS\Core\Cache\Backend\FileBackend::$cacheEntryIdentifiers = array( )
protected

Definition at line 43 of file FileBackend.php.

◆ $frozen

bool TYPO3\CMS\Core\Cache\Backend\FileBackend::$frozen = false
protected

Definition at line 47 of file FileBackend.php.

Referenced by TYPO3\CMS\Core\Cache\Backend\FileBackend\isFrozen().

◆ DATASIZE_DIGITS

◆ EXPIRYTIME_FORMAT

const TYPO3\CMS\Core\Cache\Backend\FileBackend::EXPIRYTIME_FORMAT = 'YmdHis'

Definition at line 32 of file FileBackend.php.

◆ EXPIRYTIME_LENGTH

const TYPO3\CMS\Core\Cache\Backend\FileBackend::EXPIRYTIME_LENGTH = 14

Definition at line 33 of file FileBackend.php.

◆ SEPARATOR

const TYPO3\CMS\Core\Cache\Backend\FileBackend::SEPARATOR = '^'

Definition at line 31 of file FileBackend.php.