\Hazaar
Cache
The cache frontend
Implements
Summary
Methods Properties Constants
get
has
off
on
set
No constants
Properties
$backend
$backend
$options
$options
$use_cache
$use_cache
Methods
__construct()
__construct($backend = null, $config_options = Array ( ) , $namespace = 'default')
Cache object constructor

Tags

Throws

Cache\Exception\InvalidBackend

Throws

Cache\Exception\InvalidFrontend

Parameters

$backendstring

The name of the backend to use. Currently ‘apc’, ‘file’, ‘memcached’, ‘session’ and ‘sqlite’ are supported.

$config_options

No description

$namespacestring

The namespace to use for grouping stored data.

__get()
__get($key)

Parameters

$key

No description

__isset()
__isset($key)

Parameters

$key

No description

__set()
__set($key, $value)

Parameters

$key

No description

$value

No description

__unset()
__unset($key)

Parameters

$key

No description

clear()
clear()
configure()
configure($options)

Parameters

$options

No description

extend()
extend($array, $recursive = false)

Parameters

$array

No description

$recursive

No description

get()
get($key, $default = false, $save_default = false) : mixed
Retrieve a value from cache storage.

Parameters

$keymixed

The reference key used to store the value.

$default\Hazaar\bool

If the value doesn’t exist, this default will be returned instead.

$save_default\Hazaar\bool

If the value doesn’t exist and a default is specified, save that default to cache.

Returns

mixed

The value that was stored in cache.

getBackend()
getBackend()
has()
has($key) : boolean
Check if a stored value exists.

Parameters

$keymixed

The value key to check for.

Returns

boolean

Returns TRUE or FALSE indicating if the value is stored.

off()
off()
Enable the use of cache

Cache is enabled by default. This is to allow cache to be re-enabled after calling off().

This method can also be used to force cache back on after being disabled by a “Pragma: no-cache” header in the case where the use_pragma setting is enabled (which is the default).

offsetExists()
offsetExists($offset)

Parameters

$offset

No description

offsetGet()
offsetGet($offset)

Parameters

$offset

No description

offsetSet()
offsetSet($offset, $value)

Parameters

$offset

No description

$value

No description

offsetUnset()
offsetUnset($offset)

Parameters

$offset

No description

on()
on()
Disable the use of cache

This allows a cache object to be disabled but still be used without having to modify existing application code. The application can still call the get() method but it will always return false, simulating a negative cache response. Calling set() will still have an affect however.

pull()
pull($key)

Parameters

$key

No description

remove()
remove($key) : boolean
Removes a stored value

Parameters

$keymixed

The key of the value to remove

Returns

boolean

tRUE indicates the value existed and was removed. FALSE otherwise.

set()
set($key, $value, $timeout = null) : boolean
Store a value in the cache using the current cache backend.

Parameters

$keymixed

The reference key under which to store the value.

$valuemixed

The value that should be stored. Values can be pretty much anything including integers, booleans, strings and any object that can be serialised.

$timeoutmixed

The number of seconds after which the value becomes invalid. If not set the global ‘lifetime’ option is used. Set a value of ‘-1’ to indicate that the value should never timeout.

Returns

boolean

Boolean indicating whether or not the operation succeeded.

setBackendOption()
setBackendOption($key, $value)

Parameters

$key

No description

$value

No description

setValues()
setValues($values)

Parameters

$values

No description

toArray()
toArray()