Kotchasan

CacheItemPoolInterface

CacheItemPoolInterface generates CacheItemInterface objects.

Table of Contents

clear()  : bool
Deletes all items in the pool.
commit()  : bool
Persists any deferred cache items.
deleteItem()  : bool
Removes the item from the pool.
deleteItems()  : bool
Removes multiple items from the pool.
getItem()  : CacheItemInterface
Returns a Cache Item representing the specified key.
getItems()  : array<string|int, mixed>|Traversable
Returns a traversable set of cache items.
hasItem()  : bool
Confirms if the cache contains specified cache item.
save()  : bool
Persists a cache item immediately.
saveDeferred()  : bool
Sets a cache item to be persisted later.

Methods

clear()

Deletes all items in the pool.

public clear() : bool

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

Return values
bool

commit()

Persists any deferred cache items.

public commit() : bool

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

Return values
bool

deleteItem()

Removes the item from the pool.

public deleteItem(string $key) : bool

The key for which to delete If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown. True if the item was successfully removed. False if there was an error.

Parameters
$key : string
Tags
throws
InvalidArgumentException
Return values
bool

deleteItems()

Removes multiple items from the pool.

public deleteItems(array<string|int, mixed> $keys) : bool

An array of keys that should be removed from the pool. If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown. True if the items were successfully removed. False if there was an error.

Parameters
$keys : array<string|int, mixed>
Tags
throws
InvalidArgumentException
Return values
bool

getItem()

Returns a Cache Item representing the specified key.

public getItem(string $key) : CacheItemInterface

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

The key for which to return the corresponding Cache Item. If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown. The corresponding Cache Item.

Parameters
$key : string
Tags
throws
InvalidArgumentException
Return values
CacheItemInterface

getItems()

Returns a traversable set of cache items.

public getItems([array<string|int, mixed> $keys = [] ]) : array<string|int, mixed>|Traversable

An indexed array of keys of items to retrieve. If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown. 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.

Parameters
$keys : array<string|int, mixed> = []
Tags
throws
InvalidArgumentException
Return values
array<string|int, mixed>|Traversable

hasItem()

Confirms if the cache contains specified cache item.

public hasItem(string $key) : bool

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.

The key for which to check existence. If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException MUST be thrown. True if item exists in the cache, false otherwise.

Parameters
$key : string
Tags
throws
InvalidArgumentException
Return values
bool

saveDeferred()

Sets a cache item to be persisted later.

public saveDeferred(CacheItemInterface $item) : bool

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

Parameters
$item : CacheItemInterface
Return values
bool

Search results