class ArrayStorage extends AbstractCacheStorage (View source)

Runtime Storage.

Methods

__construct(int $ttl = null, mixed $options = array())

Constructor.

getItems(array $keys = array())

getItems

deleteItems(array $keys)

Removes multiple items from the pool.

bool
hasItem(string $key)

Confirms if the cache contains specified cache item.

bool
exists(string $key)

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

array
getOptions()

Method to get property Options

setOptions(array $options)

Method to set property options

bool
saveDeferred(CacheItemInterface $item)

Sets a cache item to be persisted later.

bool
commit()

Persists any deferred cache items.

CacheItemInterface
getItem(string $key)

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

save(CacheItemInterface $item, int|DateInterval|DateTime $ttl = null)

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

deleteItem(string $key)

Remove an item from the cache by its unique key

clear()

This will wipe out the entire cache's keys

array
getData()

Method to get property Data

setData(array $data)

Method to set property data

Details

__construct(int $ttl = null, mixed $options = array())

Constructor.

Parameters

int $ttl The Time To Live (TTL) of an item
mixed $options An options array, or an object that implements \ArrayAccess

Traversable getItems(array $keys = array())

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.

AbstractCacheStorage 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

AbstractCacheStorage Return self to support chaining

bool hasItem(string $key)

Confirms if the cache contains specified cache item.

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

string $key The key for which to check existence.

Return Value

bool True if item exists in the cache, false otherwise.

Exceptions

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

at line line 34
bool exists(string $key)

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

Parameters

string $key The key for which to check existence.

Return Value

bool True if item exists in the cache, false otherwise.

array getOptions()

Method to get property Options

Return Value

array

AbstractCacheStorage setOptions(array $options)

Method to set property options

Parameters

array $options

Return Value

AbstractCacheStorage Return self to support chaining.

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.

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.

at line line 47
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 72
ArrayStorage save(CacheItemInterface $item, int|DateInterval|DateTime $ttl = null)

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.
int|DateInterval|DateTime $ttl The Time To Live of an item.

Return Value

ArrayStorage Return self to support chaining

at line line 89
ArrayStorage 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

ArrayStorage Return self to support chaining

at line line 104
ArrayStorage clear()

This will wipe out the entire cache's keys

Return Value

ArrayStorage Return self to support chaining

at line line 116
array getData()

Method to get property Data

Return Value

array

at line line 128
ArrayStorage setData(array $data)

Method to set property data

Parameters

array $data

Return Value

ArrayStorage Return self to support chaining.