PHP Class Neos\Cache\Backend\ApcBackend

This backend uses the following types of keys: - entry_xxx the actual cache entry with the data to be stored - tag_xxx xxx is tag name, value is array of associated identifiers identifier. This is "forward" tag index. It is mainly used for obtaining content by tag (get identifier by tag -> get content by identifier) - ident_xxx xxx is identifier, value is array of associated tags. This is "reverse" tag index. It provides quick access for all tags associated with this identifier and used when removing the identifier - tagIndex Value is a List of all tags (array) Each key is prepended with a prefix. By default prefix consists from two parts separated by underscore character and ends in yet another underscore character: - "Flow" - MD5 of path to Flow and the current context (Production, Development, ...) This prefix makes sure that keys from the different installations do not conflict.
Inheritance: extends AbstractBackend, implements Neos\Cache\Backend\TaggableBackendInterface, implements IterableBackendInterface, implements Neos\Cache\Backend\PhpCapableBackendInterface, use trait RequireOnceFromValueTrait
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$cacheEntriesIterator ApcIterator
$identifierPrefix string A prefix to seperate stored data from other data possible stored in the APC

Méthodes publiques

Méthode Description
__construct ( EnvironmentConfiguration $environmentConfiguration, array $options )
collectGarbage ( ) : void Does nothing, as APC does GC itself
current ( ) : mixed Returns the data of the current cache entry pointed to by the cache entry iterator.
findIdentifiersByTag ( string $tag ) : array Finds and returns all cache entry identifiers which are tagged by the specified tag.
flush ( ) : void Removes all cache entries of this cache.
flushByTag ( string $tag ) : integer Removes all cache entries of this cache which are tagged by the specified tag.
get ( string $entryIdentifier ) : mixed Loads data from the cache.
getPrefixedIdentifier ( string $entryIdentifier ) : string Returns the internally used, prefixed entry identifier for the given public entry identifier.
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.
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 the cache.
setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void Initializes the identifier prefix when setting the cache.
valid ( ) : boolean Checks if the current position of the cache entry iterator is valid

Méthodes protégées

Méthode Description
addIdentifierToTags ( string $entryIdentifier, array $tags ) : void Associates the identifier with the given tags
findTagsByIdentifier ( string $identifier ) : array Finds all tags for the given identifier. This function uses reverse tag index to search for tags.
removeIdentifierFromAllTags ( string $entryIdentifier ) : void Removes association of the identifier with the given tags

Method Details

__construct() public méthode

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

addIdentifierToTags() protected méthode

Associates the identifier with the given tags
protected addIdentifierToTags ( string $entryIdentifier, array $tags ) : void
$entryIdentifier string
$tags array
Résultat void

collectGarbage() public méthode

Does nothing, as APC does GC itself
public collectGarbage ( ) : void
Résultat void

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

findIdentifiersByTag() public méthode

Finds and returns all cache entry identifiers which are tagged by the specified tag.
public findIdentifiersByTag ( string $tag ) : array
$tag string The tag to search for
Résultat array An array with identifiers of all matching entries. An empty array if no entries matched

findTagsByIdentifier() protected méthode

Finds all tags for the given identifier. This function uses reverse tag index to search for tags.
protected findTagsByIdentifier ( string $identifier ) : array
$identifier string Identifier to find tags by
Résultat array Array with tags

flush() public méthode

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

flushByTag() public méthode

Removes all cache entries of this cache which are tagged by the specified tag.
public flushByTag ( string $tag ) : integer
$tag string The tag the entries must have
Résultat integer The number of entries which have been affected by this flush

get() public méthode

Loads data from the cache.
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

getPrefixedIdentifier() public méthode

While Flow applications will mostly refer to the simple entry identifier, it may be necessary to know the actual identifier used by the cache backend in order to share cache entries with other applications. This method allows for retrieving it.
public getPrefixedIdentifier ( string $entryIdentifier ) : string
$entryIdentifier string The short entry identifier, for example "NumberOfPostedArticles"
Résultat string The prefixed identifier, for example "Flow694a5c7a43a4_NumberOfPostedArticles"

has() public méthode

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

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

remove() public méthode

Usually this only affects one entry but if - for what reason ever - old entries for the identifier still exist, they are removed as well.
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

removeIdentifierFromAllTags() protected méthode

Removes association of the identifier with the given tags
protected removeIdentifierFromAllTags ( string $entryIdentifier ) : void
$entryIdentifier string
Résultat void

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 the cache.
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 Tags to associate with this cache entry
$lifetime integer Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited liftime.
Résultat void

setCache() public méthode

Initializes the identifier prefix when setting the cache.
public setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void
$cache Neos\Cache\Frontend\FrontendInterface
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

Property Details

$cacheEntriesIterator protected_oe property

protected ApcIterator $cacheEntriesIterator
Résultat ApcIterator

$identifierPrefix protected_oe property

A prefix to seperate stored data from other data possible stored in the APC
protected string $identifierPrefix
Résultat string