DoctrineCacheItemPool

Implements \Psr\Cache\CacheItemPoolInterface

Class DoctrineCacheItemPool

package

Ascmvc\Session\Cache

Methods

DoctrineCacheItemPool constructor.

__construct(\Ascmvc\Session\Config $config) 

Arguments

Deletes all items in the pool.

clear() : boolean

Response

boolean

True if the pool was successfully cleared. False if there was an error.

Commits any deferred cache items.

commit() : boolean

Response

boolean

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

Removes the item from the pool.

deleteItem(string $key) : boolean
Throws
\Ascmvc\Session\Cache\DoctrineInvalidArgumentException

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

Arguments

$key

string

The key to delete.

Response

boolean

True if the item was successfully removed. False if there was an error.

Removes multiple items from the pool.

deleteItems(array<mixed,string> $keys) : boolean
Throws
\Ascmvc\Session\Cache\DoctrineInvalidArgumentException

If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown.

Arguments

$keys

array<mixed,string>

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

Response

boolean

True if the items were successfully removed. False if there was an error.

Returns a Cache Item representing the specified key.

getItem(string $key) : \Psr\Cache\CacheItemInterface

This method must always return a CacheItemInterface object, even in case of a cache miss. It MUST NOT return null.

Throws
\Ascmvc\Session\Cache\DoctrineInvalidArgumentException

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

Arguments

$key

string

The key for which to return the corresponding Cache Item.

Response

\Psr\Cache\CacheItemInterface

The corresponding Cache Item.

Returns a traversable set of cache items.

getItems(array<mixed,string> $keys = array()) : array|\Traversable
Throws
\Ascmvc\Session\Cache\DoctrineInvalidArgumentException

If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown.

Arguments

$keys

array<mixed,string>

An indexed array of keys of items to retrieve.

Response

array|\Traversable

A traversable collection of Cache Items keyed by the cache keys of each item. A Cache item will be returned for each key, even if that key is not found. However, if no keys are specified then an empty traversable MUST be returned instead.

Confirms if the cache contains specified cache item.

hasItem(string $key) : boolean

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.

Throws
\Ascmvc\Session\Cache\DoctrineInvalidArgumentException

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

Arguments

$key

string

The key for which to check existence.

Response

boolean

True if item exists in the cache, false otherwise.

Persists a cache item immediately.

save(\Psr\Cache\CacheItemInterface $item) : boolean

Arguments

$item

\Psr\Cache\CacheItemInterface

The cache item to save.

Response

boolean

True if the item was successfully persisted. False if there was an error.

Sets a cache item to be committed later.

saveDeferred(\Psr\Cache\CacheItemInterface $item) : boolean

Arguments

$item

\Psr\Cache\CacheItemInterface

The cache item to save.

Response

boolean

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

Properties

Contains an instance of the storage driver.

driver : \Doctrine\Common\Cache\Cache
var

Type(s)

\Doctrine\Common\Cache\Cache

Contains an array of deferred cache items.

deferred : array
var

CacheItemInterface

Type(s)

array