Horde_Cache
in package
This class provides the API interface to the cache storage drivers.
Tags
Table of Contents
- $_logger : Horde_Log_Logger
- Logger.
- $_params : array<string|int, mixed>
- Cache parameters.
- $_storage : Horde_Cache_Storage
- Storage object.
- __construct() : mixed
- Constructor.
- clear() : mixed
- Clears all data from the cache.
- exists() : bool
- Checks if a given key exists in the cache, valid for the given lifetime.
- expire() : bool
- Expire any existing data for the given key.
- get() : mixed
- Retrieve cached data.
- output() : bool
- Attempts to directly output a cached object.
- set() : mixed
- Store an object in the cache.
- testReadWrite() : bool
- Tests the driver for read/write access.
Properties
$_logger
Logger.
protected
Horde_Log_Logger
$_logger
$_params
Cache parameters.
protected
array<string|int, mixed>
$_params
= array('compress' => \false, 'lifetime' => 86400)
$_storage
Storage object.
protected
Horde_Cache_Storage
$_storage
Methods
__construct()
Constructor.
public
__construct(Horde_Cache_Storage $storage[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $storage : Horde_Cache_Storage
-
The storage object.
- $params : array<string|int, mixed> = array()
-
Parameter array:
- compress: (boolean) Compress data (if possible)? DEFAULT: false - lifetime: (integer) Lifetime of data, in seconds. DEFAULT: 86400 seconds - logger: (Horde_Log_Logger) Log object to use for log/debug messages.
Return values
mixed —clear()
Clears all data from the cache.
public
clear() : mixed
Tags
Return values
mixed —exists()
Checks if a given key exists in the cache, valid for the given lifetime.
public
exists(string $key[, int $lifetime = 1 ]) : bool
Parameters
- $key : string
-
Cache key to check.
- $lifetime : int = 1
-
Lifetime of the key in seconds.
Tags
Return values
bool —Existence.
expire()
Expire any existing data for the given key.
public
expire(string $key) : bool
Parameters
- $key : string
-
Cache key to expire.
Return values
bool —Success or failure.
get()
Retrieve cached data.
public
get(string $key[, int $lifetime = 1 ]) : mixed
Parameters
- $key : string
-
Object ID to query.
- $lifetime : int = 1
-
Lifetime of the object in seconds.
Tags
Return values
mixed —Cached data, or false if none was found.
output()
Attempts to directly output a cached object.
public
output(string $key[, int $lifetime = 1 ]) : bool
Parameters
- $key : string
-
Object ID to query.
- $lifetime : int = 1
-
Lifetime of the object in seconds.
Tags
Return values
bool —True if output or false if no object was found.
set()
Store an object in the cache.
public
set(string $key, string $data[, int $lifetime = null ]) : mixed
Parameters
- $key : string
-
Object ID used as the caching key.
- $data : string
-
Data to store in the cache.
- $lifetime : int = null
-
Object lifetime - i.e. the time before the data becomes available for garbage collection, in seconds. If null use the default Horde GC time. If 0 will not be GC'd.
Return values
mixed —testReadWrite()
Tests the driver for read/write access.
public
testReadWrite() : bool
Return values
bool —True if read/write is available.