PHP Class Neos\Cache\Backend\SimpleFileBackend

Inheritance: extends AbstractBackend, implements Neos\Cache\Backend\PhpCapableBackendInterface, implements IterableBackendInterface
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$baseDirectory string If not given this will be determined by the EnvironmentConfiguration
$cacheDirectory string Directory where the files are stored.
$cacheEntryFileExtension string A file extension to use for each cache entry.
$cacheEntryIdentifiers array
$cacheFilesIterator DirectoryIterator
$frozen boolean
$useIgBinary boolean Caching the result of extension_loaded() here is faster than calling extension_loaded() multiple times.

Méthodes publiques

Méthode Description
__construct ( EnvironmentConfiguration $environmentConfiguration, array $options = [] )
collectGarbage ( ) : void Not necessary
current ( ) : mixed Returns the data of the current cache entry pointed to by the cache entry iterator.
flush ( ) : void Removes all cache entries of this cache.
get ( string $entryIdentifier ) : mixed Loads data from a cache file.
getBaseDirectory ( ) : string
getCacheDirectory ( ) : string Returns the directory where the cache files are stored
has ( string $entryIdentifier ) : boolean Checks if a cache entry with the specified identifier exists.
key ( ) : string Returns the identifier of the current cache entry pointed to by the cache entry iterator.
next ( ) : void Move forward to the next cache entry
remove ( string $entryIdentifier ) : boolean Removes all cache entries matching the specified identifier.
requireOnce ( string $entryIdentifier ) : mixed Loads PHP code from the cache and include_onces it right away.
rewind ( ) : void Rewinds the cache entry iterator to the first element
set ( string $entryIdentifier, string $data, array $tags = [], integer $lifetime = null ) : void Saves data in a cache file.
setBaseDirectory ( string $baseDirectory )
setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void Sets a reference to the cache frontend which uses this backend and initializes the default cache directory.
setCacheDirectory ( string $cacheDirectory ) : void Sets the directory where the cache files are stored
valid ( ) : boolean Checks if the current position of the cache entry iterator is valid

Méthodes protégées

Méthode Description
configureCacheDirectory ( )
findCacheFilesByIdentifier ( string $entryIdentifier ) : mixed Tries to find the cache entry for the specified identifier.
isCacheFileExpired ( string $cacheEntryPathAndFilename ) : boolean Checks if the given cache entry files are still valid or if their lifetime has exceeded.
readCacheFile ( string $cacheEntryPathAndFilename, integer | null $offset = null, integer | null $maxlen = null ) : boolean | string Reads the cache data from the given cache file, using locking.
throwExceptionIfPathExceedsMaximumLength ( string $cacheEntryPathAndFilename ) : void
writeCacheFile ( string $cacheEntryPathAndFilename, string $data ) : boolean | integer Writes the cache data into the given cache file, using locking.

Method Details

__construct() public méthode

public __construct ( EnvironmentConfiguration $environmentConfiguration, array $options = [] )
$environmentConfiguration Neos\Cache\EnvironmentConfiguration
$options array

collectGarbage() public méthode

Not necessary
public collectGarbage ( ) : void
Résultat void

configureCacheDirectory() protected méthode

protected configureCacheDirectory ( )

current() public méthode

Returns the data of the current cache entry pointed to by the cache entry iterator.
public current ( ) : mixed
Résultat mixed

findCacheFilesByIdentifier() protected méthode

Tries to find the cache entry for the specified identifier.
protected findCacheFilesByIdentifier ( string $entryIdentifier ) : mixed
$entryIdentifier string The cache entry identifier
Résultat mixed The filenames (including path) as an array if one or more entries could be found, otherwise FALSE

flush() public méthode

Removes all cache entries of this cache.
public flush ( ) : void
Résultat void

get() public méthode

Loads data from a cache file.
public get ( string $entryIdentifier ) : mixed
$entryIdentifier string An identifier which describes the cache entry to load
Résultat mixed The cache entry's content as a string or FALSE if the cache entry could not be loaded

getBaseDirectory() public méthode

public getBaseDirectory ( ) : string
Résultat string

getCacheDirectory() public méthode

Returns the directory where the cache files are stored
public getCacheDirectory ( ) : string
Résultat string Full path of the cache directory

has() public méthode

Checks if a cache entry with the specified identifier exists.
public has ( string $entryIdentifier ) : boolean
$entryIdentifier string
Résultat boolean TRUE if such an entry exists, FALSE if not

isCacheFileExpired() protected méthode

Checks if the given cache entry files are still valid or if their lifetime has exceeded.
protected isCacheFileExpired ( string $cacheEntryPathAndFilename ) : boolean
$cacheEntryPathAndFilename string
Résultat boolean

key() public méthode

Returns the identifier of the current cache entry pointed to by the cache entry iterator.
public key ( ) : string
Résultat string

next() public méthode

Move forward to the next cache entry
public next ( ) : void
Résultat void

readCacheFile() protected méthode

Reads the cache data from the given cache file, using locking.
protected readCacheFile ( string $cacheEntryPathAndFilename, integer | null $offset = null, integer | null $maxlen = null ) : boolean | string
$cacheEntryPathAndFilename string
$offset integer | null
$maxlen integer | null
Résultat boolean | string The contents of the cache file or FALSE on error

remove() public méthode

Usually this only affects one entry.
public remove ( string $entryIdentifier ) : boolean
$entryIdentifier string Specifies the cache entry to remove
Résultat boolean TRUE if (at least) an entry could be removed or FALSE if no entry was found

requireOnce() public méthode

Loads PHP code from the cache and include_onces it right away.
public requireOnce ( string $entryIdentifier ) : mixed
$entryIdentifier string An identifier which describes the cache entry to load
Résultat mixed Potential return value from the include operation

rewind() public méthode

Rewinds the cache entry iterator to the first element
public rewind ( ) : void
Résultat void

set() public méthode

Saves data in a cache file.
public set ( string $entryIdentifier, string $data, array $tags = [], integer $lifetime = null ) : void
$entryIdentifier string An identifier for this specific cache entry
$data string The data to be stored
$tags array Ignored in this type of cache backend
$lifetime integer Ignored in this type of cache backend
Résultat void

setBaseDirectory() public méthode

public setBaseDirectory ( string $baseDirectory )
$baseDirectory string

setCache() public méthode

Sets a reference to the cache frontend which uses this backend and initializes the default cache directory.
public setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void
$cache Neos\Cache\Frontend\FrontendInterface The cache frontend
Résultat void

setCacheDirectory() public méthode

Sets the directory where the cache files are stored
public setCacheDirectory ( string $cacheDirectory ) : void
$cacheDirectory string Full path of the cache directory
Résultat void

throwExceptionIfPathExceedsMaximumLength() protected méthode

protected throwExceptionIfPathExceedsMaximumLength ( string $cacheEntryPathAndFilename ) : void
$cacheEntryPathAndFilename string
Résultat void

valid() public méthode

Checks if the current position of the cache entry iterator is valid
public valid ( ) : boolean
Résultat boolean TRUE if the current position is valid, otherwise FALSE

writeCacheFile() protected méthode

Writes the cache data into the given cache file, using locking.
protected writeCacheFile ( string $cacheEntryPathAndFilename, string $data ) : boolean | integer
$cacheEntryPathAndFilename string
$data string
Résultat boolean | integer Return value of file_put_contents

Property Details

$baseDirectory protected_oe property

If not given this will be determined by the EnvironmentConfiguration
protected string $baseDirectory
Résultat string

$cacheDirectory protected_oe property

Directory where the files are stored.
protected string $cacheDirectory
Résultat string

$cacheEntryFileExtension protected_oe property

A file extension to use for each cache entry.
protected string $cacheEntryFileExtension
Résultat string

$cacheEntryIdentifiers protected_oe property

protected array $cacheEntryIdentifiers
Résultat array

$cacheFilesIterator protected_oe property

protected DirectoryIterator $cacheFilesIterator
Résultat DirectoryIterator

$frozen protected_oe property

protected bool $frozen
Résultat boolean

$useIgBinary protected_oe property

Caching the result of extension_loaded() here is faster than calling extension_loaded() multiple times.
protected bool $useIgBinary
Résultat boolean