cms_cache_handler View code

This singleton class provides a convenient caching capbility.

By default this uses the cms_filecache_driver to cache data in the TMP_CACHE_LOCATION for one hour.

package

CMS

license

GPL

Methods

get_instance() : \cms_cache_handler

Return a reference to the only allowed instance of this object.

static final
set_driver(\cms_cache_driver &$driver) 

Set the driver to use for caching

final

Arguments

get_driver() : \cms_cache_driver

Get the driver to use for caching, to adjust its parameters

final
clear(string $group = '') : boolean

Clear the cache.

final

If the group is not specified the current set group will be used. If that is empty then all cached values will be cleared. Use with caution.

Arguments

string $group

Response

boolean

get(string $key, string $group = '') : mixed

Get a cached value

final

Arguments

string $key

The primary key for the cached value

string $group

An optional cache group name.

Response

mixed

exists(string $key, string $group = '') : boolean

Test if a cached value exist

final

Arguments

string $key

The primary key for the cached value

string $group

An optional cache group name.

Response

boolean

erase(string $key, string $group = '') : boolean

Erase a cached value

final

Arguments

string $key

The primary key for the cached value

string $group

An optional cache group name.

Response

boolean

set(string $key, mixed $value, string $group = '') : boolean

Add or replace a value in the cache

final

Arguments

string $key

The primary key for the cached value

mixed $value

the value to save

string $group

An optional cache group name.

Response

boolean

set_group(string $group) : boolean

Set a current cache group

final

This method allows specifying a scope to all cache methods

Arguments

string $group

Response

boolean

can_cache() : boolean

Test if caching is possible Caching is not possible if there is no driver, or in an install request.

final

Response

boolean