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
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
boolclear()
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
Return values
boolerase()
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
Return values
boolexists()
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
Return values
boolget()
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
get_driver()
Get the driver to use for caching, to adjust its parameters
public
final get_driver() : cms_cache_driver
Return values
cms_cache_driverget_instance()
Return a reference to the only allowed instance of this object.
public
final static get_instance() : cms_cache_handler
Return values
cms_cache_handlerset()
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
Return values
boolset_driver()
Set the driver to use for caching
public
final set_driver(cms_cache_driver &$driver) : mixed
Parameters
- $driver : cms_cache_driver
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