class FileStorage extends AbstractCacheStorage (View source)

Filesystem cache driver for the Windwalker Framework.

Supported options: - ttl (integer) : The default number of seconds for the cache life. - file.locking (boolean) : - file.path : The path for cache files.

Methods

__construct(int $path, string $group = '', bool $denyAccess = false, 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 and not expired.

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.

boolean
clear()

This will wipe out the entire cache's keys.

CacheItemInterface
getItem(string $key)

Method to get a storage entry value from a key.

boolean
deleteItem(string $key)

Method to remove a storage entry for a key.

save(CacheItemInterface $item)

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

string
fetchStreamUri(string $key)

Get the full stream URI for the cache entry.

boolean
isExpired(string $key)

Check whether or not the cached data by id has expired.

boolean
denyAccess(boolean $bool = null)

getDenyAccess

string
getGroup()

Method to get property Group

setGroup(string $group)

Method to set property group

string
getPath()

Method to get property Path

setPath(string $path)

Method to set property path

setFileFormat(string $format)

setFileFormat

Details

at line line 69
__construct(int $path, string $group = '', bool $denyAccess = false, int $ttl = null, mixed $options = array())

Constructor.

Parameters

int $path
string $group
bool $denyAccess
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 255
bool exists(string $key)

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

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 89
boolean clear()

This will wipe out the entire cache's keys.

...

Return Value

boolean The result of the clear operation.

at line line 123
CacheItemInterface getItem(string $key)

Method to get a storage entry value from a key.

Parameters

string $key The storage entry identifier.

Return Value

CacheItemInterface

Exceptions

RuntimeException

at line line 153
boolean deleteItem(string $key)

Method to remove a storage entry for a key.

Parameters

string $key The storage entry identifier.

Return Value

boolean True on success

at line line 165
FileStorage 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

FileStorage Return self to support chaining

at line line 314
string fetchStreamUri(string $key)

Get the full stream URI for the cache entry.

Parameters

string $key The storage entry identifier.

Return Value

string The full stream URI for the cache entry.

Exceptions

RuntimeException if the cache path is invalid.

at line line 342
boolean isExpired(string $key)

Check whether or not the cached data by id has expired.

Parameters

string $key The storage entry identifier.

Return Value

boolean True if the data has expired.

at line line 360
boolean denyAccess(boolean $bool = null)

getDenyAccess

Parameters

boolean $bool

Return Value

boolean

at line line 375
string getGroup()

Method to get property Group

Return Value

string

at line line 387
FileStorage setGroup(string $group)

Method to set property group

Parameters

string $group

Return Value

FileStorage Return self to support chaining.

at line line 399
string getPath()

Method to get property Path

Return Value

string

at line line 411
FileStorage setPath(string $path)

Method to set property path

Parameters

string $path

Return Value

FileStorage Return self to support chaining.

at line line 425
FileStorage setFileFormat(string $format)

setFileFormat

Parameters

string $format

Return Value

FileStorage