\Hazaar
Cache
The cache frontend
Implements
Summary
Methods Properties Constants
get
has
set
No constants
Properties
$backend
$backend
$options
$options
$use_cache
$use_cache
Methods
__construct()
__construct($backend = null, $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.

$optionsarray

Options to pass on to the backend. These will also be specific to the backend you are using.

$namespacestring

The namespace to use for grouping stored data.

__destruct()
__destruct()
__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.

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.

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

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.

setValues()
setValues($values)

Parameters

$values

No description

toArray()
toArray()