final class ArrayCacheItemPool implements CacheItemPoolInterface (View source)

Stores PSR-6 cache entries in request-local memory with lazy expiration.

Deferred entries become visible only after commit, and no state survives the pool instance.

Methods

CacheItemInterface
getItem(string $key)

Returns a hit for a live entry or a new miss item while removing expired state.

CacheItemInterface
iterable
getItems(array $keys = [])

Returns requested entries keyed by their original cache keys.

iterable
bool
hasItem(string $key)

Reports whether a live entry exists for the validated key.

bool
bool
clear()

Removes all stored and deferred entries from this pool instance.

bool
bool
deleteItem(string $key)

Removes one stored or deferred entry and succeeds when it is already absent.

bool
bool
deleteItems(array $keys)

Removes each requested entry and succeeds when all keys are valid.

bool
bool
save(CacheItemInterface $item)

Stores a framework cache item immediately and rejects foreign item implementations.

bool
bool
saveDeferred(CacheItemInterface $item)

Queues a framework cache item for a later commit without making it visible yet.

bool
bool
commit()

Persists every deferred entry and reports whether all saves succeeded.

bool

Details

getItem

CacheItemInterface getItem(string $key)

Returns a hit for a live entry or a new miss item while removing expired state.

Parameters

string $key

Return Value

CacheItemInterface

Exceptions

InvalidCacheKeyException

getItems

iterable getItems(array $keys = [])

Returns requested entries keyed by their original cache keys.

Parameters

array $keys

Return Value

iterable

Exceptions

InvalidCacheKeyException

hasItem

bool hasItem(string $key)

Reports whether a live entry exists for the validated key.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCacheKeyException

clear

bool clear()

Removes all stored and deferred entries from this pool instance.

Return Value

bool

deleteItem

bool deleteItem(string $key)

Removes one stored or deferred entry and succeeds when it is already absent.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCacheKeyException

deleteItems

bool deleteItems(array $keys)

Removes each requested entry and succeeds when all keys are valid.

Parameters

array $keys

Return Value

bool

Exceptions

InvalidCacheKeyException

save

bool save(CacheItemInterface $item)

Stores a framework cache item immediately and rejects foreign item implementations.

Parameters

CacheItemInterface $item

Return Value

bool

Exceptions

InvalidCacheKeyException

saveDeferred

bool saveDeferred(CacheItemInterface $item)

Queues a framework cache item for a later commit without making it visible yet.

Parameters

CacheItemInterface $item

Return Value

bool

Exceptions

InvalidCacheKeyException

commit

bool commit()

Persists every deferred entry and reports whether all saves succeeded.

Return Value

bool