interface CacheStorageInterface (View source)

Class CacheStorageInterface

Methods

CacheItemInterface
getItem(string $key)

Here we pass in a cache key to be fetched from the cache.

getItems(array $keys)

getItems

boolean
hasItem(string $key)

Method to determine whether a storage entry has been set for a key.

clear()

This will wipe out the entire cache's keys

deleteItem(string $key)

Remove an item from the cache by its unique key

deleteItems(array $keys)

Removes multiple items from the pool.

save(CacheItemInterface $item)

Persisting our data in the cache, uniquely referenced by a key with an optional expiration TTL time.

bool
saveDeferred(CacheItemInterface $item)

Sets a cache item to be persisted later.

bool
commit()

Persists any deferred cache items.

Details

at line line 28
CacheItemInterface getItem(string $key)

Here we pass in a cache key to be fetched from the cache.

A CacheItem object will be constructed and returned to us

Parameters

string $key The unique key of this item in the cache

Return Value

CacheItemInterface The newly populated CacheItem class representing the stored data in the cache

at line line 39
Traversable getItems(array $keys)

getItems

Parameters

array $keys

Return Value

Traversable A traversable collection of Cache Items in the same order as the $keys parameter, keyed by the cache keys of each item. If no items are found an empty Traversable collection will be returned.

at line line 48
boolean hasItem(string $key)

Method to determine whether a storage entry has been set for a key.

Parameters

string $key The storage entry identifier.

Return Value

boolean

at line line 55
CacheStorageInterface clear()

This will wipe out the entire cache's keys

Return Value

CacheStorageInterface Return self to support chaining

at line line 64
CacheStorageInterface deleteItem(string $key)

Remove an item from the cache by its unique key

Parameters

string $key The unique cache key of the item to remove

Return Value

CacheStorageInterface Return self to support chaining

at line line 73
CacheStorageInterface deleteItems(array $keys)

Removes multiple items from the pool.

Parameters

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

Return Value

CacheStorageInterface Return self to support chaining

at line line 82
CacheStorageInterface save(CacheItemInterface $item)

Persisting our data in the cache, uniquely referenced by a key with an optional expiration TTL time.

Parameters

CacheItemInterface $item The cache item to store.

Return Value

CacheStorageInterface Return self to support chaining

at line line 93
bool saveDeferred(CacheItemInterface $item)

Sets a cache item to be persisted later.

Parameters

CacheItemInterface $item The cache item to save.

Return Value

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

at line line 101
bool commit()

Persists any deferred cache items.

Return Value

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