PHP Класс Neos\Cache\Backend\MemcachedBackend

This backend uses the following types of cache keys: - 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 script path and filename and SAPI name This prefix makes sure that keys from the different installations do not conflict. Note: When using the Memcache backend to store values of more than ~1 MB, the data will be split into chunks to make them fit into the caches limits.
Наследование: extends AbstractBackend, implements Neos\Cache\Backend\TaggableBackendInterface, implements Neos\Cache\Backend\PhpCapableBackendInterface, use trait RequireOnceFromValueTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$flags integer Indicates whether the memcache uses compression or not (requires zlib), either 0 or MEMCACHE_COMPRESSED
$identifierPrefix string A prefix to separate stored data from other data possible stored in the memcache
$memcache Memcache | Memcached Instance of the PHP Memcache/Memcached class
$servers array Array of Memcache server configurations

Открытые методы

Метод Описание
__construct ( EnvironmentConfiguration $environmentConfiguration, array $options = [] )
collectGarbage ( ) : void Does nothing, as memcache/memcached does GC itself
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.
remove ( string $entryIdentifier ) : boolean Removes all cache entries matching the specified identifier.
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.

Защищенные методы

Метод Описание
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
setCompression ( boolean $useCompression ) : void Setter for compression flags bit
setItem ( string $key, string $value, integer $expiration ) : boolean Stores an item on the server
setServers ( array $servers ) : void Setter for servers to be used. Expects an array, the values are expected to be formatted like "[:]" or "unix://"

Описание методов

__construct() публичный Метод

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

addIdentifierToTags() защищенный Метод

Associates the identifier with the given tags
protected addIdentifierToTags ( string $entryIdentifier, array $tags ) : void
$entryIdentifier string
$tags array
Результат void

collectGarbage() публичный Метод

Does nothing, as memcache/memcached does GC itself
public collectGarbage ( ) : void
Результат void

findIdentifiersByTag() публичный Метод

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
Результат array An array with identifiers of all matching entries. An empty array if no entries matched

findTagsByIdentifier() защищенный Метод

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
Результат array Array with tags

flush() публичный Метод

Removes all cache entries of this cache.
public flush ( ) : void
Результат void

flushByTag() публичный Метод

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
Результат integer The number of entries which have been affected by this flush

get() публичный Метод

Loads data from the cache.
public get ( string $entryIdentifier ) : mixed
$entryIdentifier string An identifier which describes the cache entry to load
Результат mixed The cache entry's content as a string or FALSE if the cache entry could not be loaded

getPrefixedIdentifier() публичный Метод

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"
Результат string The prefixed identifier, for example "Flow694a5c7a43a4_NumberOfPostedArticles"

has() публичный Метод

Checks if a cache entry with the specified identifier exists.
public has ( string $entryIdentifier ) : boolean
$entryIdentifier string An identifier specifying the cache entry
Результат boolean TRUE if such an entry exists, FALSE if not

remove() публичный Метод

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
Результат boolean TRUE if (at least) an entry could be removed or FALSE if no entry was found

removeIdentifierFromAllTags() защищенный Метод

Removes association of the identifier with the given tags
protected removeIdentifierFromAllTags ( string $entryIdentifier ) : void
$entryIdentifier string
Результат void

set() публичный Метод

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 lifetime.
Результат void

setCache() публичный Метод

Initializes the identifier prefix when setting the cache.
public setCache ( Neos\Cache\Frontend\FrontendInterface $cache ) : void
$cache Neos\Cache\Frontend\FrontendInterface
Результат void

setCompression() защищенный Метод

Setter for compression flags bit
protected setCompression ( boolean $useCompression ) : void
$useCompression boolean
Результат void

setItem() защищенный Метод

Stores an item on the server
protected setItem ( string $key, string $value, integer $expiration ) : boolean
$key string
$value string
$expiration integer
Результат boolean

setServers() защищенный Метод

Setter for servers to be used. Expects an array, the values are expected to be formatted like "[:]" or "unix://"
protected setServers ( array $servers ) : void
$servers array An array of servers to add.
Результат void

Описание свойств

$flags защищенное свойство

Indicates whether the memcache uses compression or not (requires zlib), either 0 or MEMCACHE_COMPRESSED
protected int $flags
Результат integer

$identifierPrefix защищенное свойство

A prefix to separate stored data from other data possible stored in the memcache
protected string $identifierPrefix
Результат string

$memcache защищенное свойство

Instance of the PHP Memcache/Memcached class
protected Memcache|Memcached $memcache
Результат Memcache | Memcached

$servers защищенное свойство

Array of Memcache server configurations
protected array $servers
Результат array