interface ItemInterface implements CacheItemInterface

Augments PSR-6's CacheItemInterface with support for tags and metadata.

Constants

METADATA_EXPIRY

References the Unix timestamp stating when the item will expire.

METADATA_CTIME

References the time the item took to be created, in milliseconds.

METADATA_TAGS

References the list of tags that were assigned to the item, as string[].

Methods

tag(string|string[] $tags)

Adds a tag to a cache item.

array
getMetadata()

Returns a list of metadata info that were saved alongside with the cached value.

Details

ItemInterface tag(string|string[] $tags)

Adds a tag to a cache item.

Tags are strings that follow the same validation rules as keys.

Parameters

string|string[] $tags A tag or array of tags

Return Value

ItemInterface

Exceptions

InvalidArgumentException When $tag is not valid
CacheException When the item comes from a pool that is not tag-aware

array getMetadata()

Returns a list of metadata info that were saved alongside with the cached value.

See ItemInterface::METADATA_* consts for keys potentially found in the returned array.

Return Value

array