class AbstractCacheStorage implements CacheItemPoolInterface (View source)

Class AbstractCacheStorage

Methods

__construct(int $ttl = null, mixed $options = array())

Constructor.

getItems(array $keys = array())

getItems

deleteItems(array $keys)

Removes multiple items from the pool.

bool
hasItem(string $key)

Confirms if the cache contains specified cache item.

bool
exists(string $key)

Confirms if the cache contains specified cache item.

array
getOptions()

Method to get property Options

setOptions(array $options)

Method to set property options

bool
saveDeferred(CacheItemInterface $item)

Sets a cache item to be persisted later.

bool
commit()

Persists any deferred cache items.

Details

at line line 59
__construct(int $ttl = null, mixed $options = array())

Constructor.

Parameters

int $ttl The Time To Live (TTL) of an item
mixed $options An options array, or an object that implements \ArrayAccess

at line line 74
Traversable getItems(array $keys = array())

getItems

Parameters

array $keys

Return Value

Traversable A traversable collection of Cache Items in the same order as the $keys parameter, keyed by the cache keys of each item. If no items are found an empty Traversable collection will be returned.

at line line 93
AbstractCacheStorage deleteItems(array $keys)

Removes multiple items from the pool.

Parameters

array $keys An array of keys that should be removed from the pool.

Return Value

AbstractCacheStorage Return self to support chaining

at line line 120
bool hasItem(string $key)

Confirms if the cache contains specified cache item.

Note: This method MAY avoid retrieving the cached value for performance reasons. This could result in a race condition with CacheItemInterface::get(). To avoid such situation use CacheItemInterface::isHit() instead.

Parameters

string $key The key for which to check existence.

Return Value

bool True if item exists in the cache, false otherwise.

Exceptions

InvalidArgumentException If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown.

at line line 142
abstract bool exists(string $key)

Confirms if the cache contains specified cache item.

Note: This method MAY avoid retrieving the cached value for performance reasons. This could result in a race condition with CacheItemInterface::get(). To avoid such situation use CacheItemInterface::isHit() instead.

Parameters

string $key The key for which to check existence.

Return Value

bool True if item exists in the cache, false otherwise.

Exceptions

InvalidArgumentException If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown.

at line line 149
array getOptions()

Method to get property Options

Return Value

array

at line line 161
AbstractCacheStorage setOptions(array $options)

Method to set property options

Parameters

array $options

Return Value

AbstractCacheStorage Return self to support chaining.

at line line 177
bool saveDeferred(CacheItemInterface $item)

Sets a cache item to be persisted later.

Parameters

CacheItemInterface $item The cache item to save.

Return Value

bool False if the item could not be queued or if a commit was attempted and failed. True otherwise.

at line line 195
bool commit()

Persists any deferred cache items.

Return Value

bool True if all not-yet-saved items were successfully saved or there were none. False otherwise.