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

Public Member Functions

 initializeObject ()
 
 setCache (\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache)
 
 setCacheDirectory ($cacheDirectory)
 
 getCacheDirectory ()
 
 set ($entryIdentifier, $data, array $tags=array(), $lifetime=null)
 
 get ($entryIdentifier)
 
 has ($entryIdentifier)
 
 remove ($entryIdentifier)
 
 flush ()
 
 collectGarbage ()
 
 requireOnce ($entryIdentifier)
 
- Public Member Functions inherited from AbstractBackend
 __construct ($context, array $options=array())
 
 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 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 AbstractBackend
 calculateExpiryTime ($lifetime=null)
 

Protected Attributes

 $cacheDirectory = ''
 
 $temporaryCacheDirectory = ''
 
 $cacheEntryFileExtension = ''
 
 $cacheEntryIdentifiers = array()
 
 $frozen = false
 
 $useIgBinary = false
 
- Protected Attributes inherited from 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 ( )

Not necessary

Returns
void

Implements BackendInterface.

Definition at line 352 of file SimpleFileBackend.php.

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
\TYPO3\CMS\Core\Cache\ExceptionIf directory is not writable after creation

Definition at line 201 of file SimpleFileBackend.php.

Referenced by SimpleFileBackend\setCache().

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 SimpleFileBackend\$cacheEntryFileExtension.

flush ( )

Removes all cache entries of this cache.

Returns
void

Implements BackendInterface.

Definition at line 328 of file SimpleFileBackend.php.

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
\InvalidArgumentExceptionIf identifier is invalid

Implements BackendInterface.

Definition at line 269 of file SimpleFileBackend.php.

References SimpleFileBackend\$cacheEntryFileExtension.

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 SimpleFileBackend\$cacheDirectory.

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
\InvalidArgumentException

Implements BackendInterface.

Definition at line 289 of file SimpleFileBackend.php.

initializeObject ( )

Initializes this cache frontend

Returns
void

Definition at line 78 of file SimpleFileBackend.php.

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 (   $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
\InvalidArgumentException

Implements BackendInterface.

Definition at line 306 of file SimpleFileBackend.php.

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
\InvalidArgumentException

Implements PhpCapableBackendInterface.

Definition at line 376 of file SimpleFileBackend.php.

References SimpleFileBackend\$cacheEntryFileExtension.

set (   $entryIdentifier,
  $data,
array  $tags = array(),
  $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$lifetimeLifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
Returns
void
Exceptions
\TYPO3\CMS\Core\Cache\Exceptionif the directory does not exist or is not writable or exceeds the maximum allowed path length, or if no cache frontend has been set.
\TYPO3\CMS\Core\Cache\Exception\InvalidDataExceptionif the data to bes stored is not a string.
\InvalidArgumentException

Implements BackendInterface.

Definition at line 237 of file SimpleFileBackend.php.

References SimpleFileBackend\$cacheEntryFileExtension, StringUtility\getUniqueId(), and GeneralUtility\makeInstance().

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
\TYPO3\CMS\Core\Cache\Exception
Returns
void

Implements BackendInterface.

Definition at line 95 of file SimpleFileBackend.php.

References SimpleFileBackend\$temporaryCacheDirectory, SimpleFileBackend\createFinalCacheDirectory(), and GeneralUtility\getMaximumPathLength().

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
\TYPO3\CMS\Core\Cache\Exceptionif the directory is not within allowed

Definition at line 133 of file SimpleFileBackend.php.

References SimpleFileBackend\$cacheDirectory, and GeneralUtility\isFirstPartOfStr().

Member Data Documentation

$cacheDirectory = ''
protected
$cacheEntryFileExtension = ''
protected
$cacheEntryIdentifiers = array()
protected

Definition at line 58 of file SimpleFileBackend.php.

$frozen = false
protected

Definition at line 63 of file SimpleFileBackend.php.

$temporaryCacheDirectory = ''
protected

Definition at line 46 of file SimpleFileBackend.php.

Referenced by SimpleFileBackend\setCache().

$useIgBinary = false
protected

Definition at line 71 of file SimpleFileBackend.php.

const DATASIZE_DIGITS = 10

Definition at line 29 of file SimpleFileBackend.php.

const EXPIRYTIME_FORMAT = 'YmdHis'

Definition at line 27 of file SimpleFileBackend.php.

const EXPIRYTIME_LENGTH = 14

Definition at line 28 of file SimpleFileBackend.php.

const SEPARATOR = '^'

Definition at line 26 of file SimpleFileBackend.php.