PHP Class lithium\storage\cache\adapter\Memory

This Memory adapter provides basic support for write, read, delete and clear cache functionality, as well as allowing the first four methods to be filtered as per the Lithium filtering system. This cache adapter does not implement any expiry-based cache invalidation logic, as the cached data will only persist for the lifetime of the current request. As a result, this cache adapter is best suited for generic memoization of data, and should not be used for for anything that must persist longer than the current request cycle.
Inheritance: extends lithium\core\Object
Afficher le fichier Open project: unionofrad/lithium

Protected Properties

Свойство Type Description
$_cache array Array used to store cached data by this adapter

Méthodes publiques

Méthode Description
__get ( string $variable ) : mixed Magic method to provide an accessor (getter) to protected class variables.
clear ( ) : boolean Clears entire cache by flushing it. All cache keys using the configuration but *without* honoring the scope are removed.
decrement ( string $key, integer $offset = 1 ) : integer | boolean Performs a decrement operation on specified numeric cache item.
delete ( array $keys ) : boolean Will attempt to remove specified keys from the user space cache.
increment ( string $key, integer $offset = 1 ) : integer | boolean Performs an increment operation on specified numeric cache item.
read ( array $keys ) : array Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.
write ( array $keys, null | string $expiry = null ) : boolean Write values to the cache.

Method Details

__get() public méthode

Magic method to provide an accessor (getter) to protected class variables.
public __get ( string $variable ) : mixed
$variable string The variable requested.
Résultat mixed Variable if it exists, null otherwise.

clear() public méthode

The operation will continue to remove keys even if removing one single key fails, clearing thoroughly as possible. In any case this method will return true.
public clear ( ) : boolean
Résultat boolean Always returns `true`.

decrement() public méthode

Performs a decrement operation on specified numeric cache item.
public decrement ( string $key, integer $offset = 1 ) : integer | boolean
$key string Key of numeric cache item to decrement.
$offset integer Offset to decrement - defaults to `1`.
Résultat integer | boolean The item's new value on successful decrement, else `false`.

delete() public méthode

Will attempt to remove specified keys from the user space cache.
public delete ( array $keys ) : boolean
$keys array Keys to uniquely identify the cached items.
Résultat boolean `true` on successful delete, `false` otherwise.

increment() public méthode

Performs an increment operation on specified numeric cache item.
public increment ( string $key, integer $offset = 1 ) : integer | boolean
$key string Key of numeric cache item to increment.
$offset integer Offset to increment - defaults to `1`.
Résultat integer | boolean The item's new value on successful increment, else `false`.

read() public méthode

Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.
public read ( array $keys ) : array
$keys array Keys to uniquely identify the cached items.
Résultat array Cached values keyed by cache keys on successful read, keys which could not be read will not be included in the results array.

write() public méthode

Write values to the cache.
public write ( array $keys, null | string $expiry = null ) : boolean
$keys array Key/value pairs with keys to uniquely identify the to-be-cached item.
$expiry null | string Unused.
Résultat boolean `true` on successful write, `false` otherwise.

Property Details

$_cache protected_oe property

Array used to store cached data by this adapter
protected array $_cache
Résultat array