\Anax\CacheCFileCache

File based cache.

Summary

Methods
Properties
Constants
configure()
createKey()
filename()
get()
put()
prune()
pruneAll()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$config
N/A

Properties

$config

$config : 

Properties

Type

Methods

configure()

configure(\Anax\array/string  $what) : $this

Read configuration from file or array'.

Parameters

\Anax\array/string $what

is an array with key/value config options or a file to be included which returns such an array.

Returns

$this —

for chaining.

createKey()

createKey(string  $class, string  $id) : string

Create a key to use for the cache.

Parameters

string $class

name of the class, including namespace.

string $id

unique id for item in each class.

Returns

string —

the filename.

filename()

filename(string  $key) : string

Generate a filename for the cached object.

Parameters

string $key

to the cached object.

Returns

string —

the filename.

get()

get(string  $key, boolean  $age = false) : mixed

Get an item from the cache if available.

Parameters

string $key

to the cached object.

boolean $age

check the age or not, defaults to false.

Returns

mixed —

the cached object or false if it has aged or null if it does not exists.

put()

put(string  $key, mixed  $item) : void

Put an item to the cache.

Parameters

string $key

to the cached object.

mixed $item

the object to be cached.

Throws

\Anax\Cache\Exception

if failing to write to cache.

prune()

prune(string  $key) : void

Prune a item from cache.

Parameters

string $key

to the cached object.

pruneAll()

pruneAll() : integer

Prune all items from cache.

Returns

integer —

number of items removed.