CMS Made Simple API

cms_cache_handler
in package

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.

Tags
license

GPL

Table of Contents

Methods

can_cache()  : bool
Test if caching is possible Caching is not possible if there is no driver, or in an install request.
clear()  : bool
Clear the cache.
erase()  : bool
Erase a cached value
exists()  : bool
Test if a cached value exist
get()  : mixed
Get a cached value
get_driver()  : cms_cache_driver
Get the driver to use for caching, to adjust its parameters
get_instance()  : cms_cache_handler
Return a reference to the only allowed instance of this object.
set()  : bool
Add or replace a value in the cache
set_driver()  : mixed
Set the driver to use for caching
set_group()  : bool
Set a current cache group

Methods

can_cache()

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

public final can_cache() : bool
Return values
bool

clear()

Clear the cache.

public final clear([string $group = '' ]) : bool

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.

Parameters
$group : string = ''
Tags
see
cms_cache_handler::set_group
Return values
bool

erase()

Erase a cached value

public final erase(string $key[, string $group = '' ]) : bool
Parameters
$key : string

The primary key for the cached value

$group : string = ''

An optional cache group name.

Tags
see
cms_cache_handler::set_group
Return values
bool

exists()

Test if a cached value exist

public final exists(string $key[, string $group = '' ]) : bool
Parameters
$key : string

The primary key for the cached value

$group : string = ''

An optional cache group name.

Tags
see
cms_cache_handler::set_group
Return values
bool

get()

Get a cached value

public final get(string $key[, string $group = '' ]) : mixed
Parameters
$key : string

The primary key for the cached value

$group : string = ''

An optional cache group name.

Tags
see
cms_cache_handler::set_group

set()

Add or replace a value in the cache

public final set(string $key, mixed $value[, string $group = '' ]) : bool
Parameters
$key : string

The primary key for the cached value

$value : mixed

the value to save

$group : string = ''

An optional cache group name.

Tags
see
cms_cache_handler::set_group
Return values
bool

set_group()

Set a current cache group

public final set_group(string $group) : bool

This method allows specifying a scope to all cache methods

Parameters
$group : string
Return values
bool

        
On this page

Search results