Documentation

TagAwareAdapterInterface extends AdapterInterface

Interface for invalidating cached items using tags.

Tags
author

Nicolas Grekas p@tchwork.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()  : 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.
invalidateTags()  : bool
Invalidates cached items using tags.
save()  : bool
Persists a cache item immediately.
saveDeferred()  : bool
Sets a cache item to be persisted later.

Methods

deleteItem()

Removes the item from the pool.

public deleteItem(string $key) : bool
Parameters
$key : string
Tags
throws
InvalidArgumentException

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

Return values
bool

deleteItems()

Removes multiple items from the pool.

public deleteItems(array<string|int, string> $keys) : bool
Parameters
$keys : array<string|int, string>
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

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.

Parameters
$key : string
Tags
throws
InvalidArgumentException

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

Return values
CacheItemInterface

getItems()

Returns a traversable set of cache items.

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

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

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.

Parameters
$key : string
Tags
throws
InvalidArgumentException

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

Return values
bool

invalidateTags()

Invalidates cached items using tags.

public invalidateTags(array<string|int, string> $tags) : bool
Parameters
$tags : array<string|int, string>

An array of tags to invalidate

Tags
throws
InvalidArgumentException

When $tags is not valid

Return values
bool

Search results