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

Public Member Functions

 initializeObject ()
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setCacheDirectory ($cacheDirectory)
 
 getCacheDirectory ()
 
 set ($entryIdentifier, $data, array $tags=[], $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 flush ()
 
 collectGarbage ()
 
 requireOnce ($entryIdentifier)
 
- 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)
 

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\AbstractBackend
const DATETIME_EXPIRYTIME_UNLIMITED = '9999-12-31T23:59:59+0000'
 
const UNLIMITED_LIFETIME = 0
 

Protected Member Functions

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

Protected Attributes

 $cacheDirectory = ''
 
 $temporaryCacheDirectory = ''
 
 $cacheEntryFileExtension = ''
 
 $cacheEntryIdentifiers = []
 
 $frozen = false
 
 $useIgBinary = false
 
- Protected Attributes inherited from TYPO3\CMS\Core\Cache\Backend\AbstractBackend
 $cache
 
 $cacheIdentifier
 
 $context
 
 $defaultLifetime = 3600
 

Detailed Description

A caching backend which stores cache entries in files, but does not support or care about expiry times and tags.

Definition at line 24 of file SimpleFileBackend.php.

Member Function Documentation

◆ collectGarbage()

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

Not necessary

Returns
void

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

Definition at line 352 of file SimpleFileBackend.php.

◆ createFinalCacheDirectory()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::createFinalCacheDirectory (   $finalCacheDirectory)
protected

Create the final cache directory if it does not exist. This method exists in TYPO3 v4 only.

Parameters
string$finalCacheDirectoryAbsolute path to final cache directory
Returns
void
Exceptions

Definition at line 201 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep().

Referenced by TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\setCache().

◆ findCacheFilesByIdentifier()

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

Tries to find the cache entry for the specified identifier.

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

Definition at line 362 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheEntryFileExtension.

◆ flush()

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

Removes all cache entries of this cache.

Returns
void

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

Definition at line 328 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\flushDirectory().

◆ get()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::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 content as a string or FALSE if the cache entry could not be loaded
Exceptions

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

Definition at line 269 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheEntryFileExtension.

◆ getCacheDirectory()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::getCacheDirectory ( )

Returns the directory where the cache files are stored

Returns
string Full path of the cache directory

Definition at line 219 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheDirectory.

◆ has()

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

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

Definition at line 289 of file SimpleFileBackend.php.

◆ initializeObject()

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

Initializes this cache frontend

Returns
void

Definition at line 78 of file SimpleFileBackend.php.

◆ isCacheFileExpired()

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

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

Parameters
string$cacheEntryPathAndFilename
Returns
bool

Definition at line 341 of file SimpleFileBackend.php.

◆ remove()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::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
bool TRUE if (at least) an entry could be removed or FALSE if no entry was found
Exceptions

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

Definition at line 306 of file SimpleFileBackend.php.

◆ requireOnce()

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

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

Parameters
string$entryIdentifierAn identifier which describes the cache entry to load
Returns
mixed Potential return value from the include operation
Exceptions

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

Definition at line 376 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheEntryFileExtension.

◆ set()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::set (   $entryIdentifier,
  $data,
array  $tags = [],
  $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
int$lifetimeThis cache backend does not support life times
Returns
void
Exceptions

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

Definition at line 237 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheEntryFileExtension, TYPO3\CMS\Core\Utility\GeneralUtility\fixPermissions(), TYPO3\CMS\Core\Utility\StringUtility\getUniqueId(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ setCache()

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

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

TYPO3 v4 note: This method is different between TYPO3 v4 and FLOW3 because the Environment class to get the path to a temporary directory does not exist in v4.

Parameters
\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface$cacheThe cache frontend
Exceptions

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

Definition at line 95 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$temporaryCacheDirectory, TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\createFinalCacheDirectory(), and TYPO3\CMS\Core\Utility\GeneralUtility\getMaximumPathLength().

◆ setCacheDirectory()

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::setCacheDirectory (   $cacheDirectory)

Sets the directory where the cache files are stored. By default it is assumed that the directory is below the TYPO3_DOCUMENT_ROOT. However, an absolute path can be selected, too.

This method does not exist in FLOW3 anymore, but it is needed in TYPO3 v4 to enable a cache path outside of document root. The final cache path is checked and created in createFinalCachDirectory(), called by setCache() method, which is done after the cacheDirectory option was handled.

Parameters
string$cacheDirectoryThe cache base directory. If a relative path
Returns
void
Exceptions

Definition at line 133 of file SimpleFileBackend.php.

References TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\$cacheDirectory, and TYPO3\CMS\Core\Utility\GeneralUtility\isFirstPartOfStr().

Member Data Documentation

◆ $cacheDirectory

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::$cacheDirectory = ''
protected

◆ $cacheEntryFileExtension

◆ $cacheEntryIdentifiers

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::$cacheEntryIdentifiers = []
protected

Definition at line 58 of file SimpleFileBackend.php.

◆ $frozen

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

Definition at line 63 of file SimpleFileBackend.php.

◆ $temporaryCacheDirectory

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::$temporaryCacheDirectory = ''
protected

◆ $useIgBinary

TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::$useIgBinary = false
protected

Definition at line 71 of file SimpleFileBackend.php.

◆ DATASIZE_DIGITS

const TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend::DATASIZE_DIGITS = 10

Definition at line 29 of file SimpleFileBackend.php.

◆ EXPIRYTIME_FORMAT

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

Definition at line 27 of file SimpleFileBackend.php.

◆ EXPIRYTIME_LENGTH

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

Definition at line 28 of file SimpleFileBackend.php.

◆ SEPARATOR

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

Definition at line 26 of file SimpleFileBackend.php.