FileAccess Orion

AdapterInterface extends CacheItemPoolInterface

Interface for adapters managing instances of Symfony's CacheItem.

Tags
author

Kévin Dunglas dunglas@gmail.com

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()  : CacheItem
Returns a Cache Item representing the specified key.
getItems()  : Traversable|array<string|int, CacheItem>
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([string $prefix = '' ]) : bool
Parameters
$prefix : string = ''
Return values
bool

commit()

Persists any deferred cache items.

public commit() : bool
Return values
bool

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

deleteItem()

Removes the item from the pool.

public deleteItem(string $key) : bool
Parameters
$key : string

The key to delete.

Tags
throws
InvalidArgumentException

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

Return values
bool

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

deleteItems()

Removes multiple items from the pool.

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

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

Tags
throws
InvalidArgumentException

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

Return values
bool

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

getItem()

Returns a Cache Item representing the specified key.

public getItem(mixed $key) : CacheItem
Parameters
$key : mixed

The key for which to return the corresponding Cache Item.

Return values
CacheItem

getItems()

Returns a traversable set of cache items.

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

An indexed array of keys of items to retrieve.

Return values
Traversable|array<string|int, CacheItem>

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.

Parameters
$key : string

The key for which to check existence.

Tags
throws
InvalidArgumentException

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

Return values
bool

True if item exists in the cache, false otherwise.

saveDeferred()

Sets a cache item to be persisted later.

public saveDeferred(CacheItemInterface $item) : bool
Parameters
$item : CacheItemInterface

The cache item to save.

Return values
bool

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

Search results