Horde_Cache_Storage_Mock
extends Horde_Cache_Storage_Memory
in package
Cache storage in PHP memory.
It persists only during a script run and ignores the object lifetime because of that.
Tags
Table of Contents
- $_logger : Horde_Log_Logger
- Logger.
- $_params : array<string|int, mixed>
- Parameters.
- $_cache : array<string|int, mixed>
- Storage for this cache.
- __construct() : mixed
- Constructor.
- __serialize() : array<string|int, mixed>
- __unserialize() : void
- 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.
- serialize() : mixed
- set() : mixed
- Store an object in the cache.
- setLogger() : mixed
- Set the logging object.
- unserialize() : mixed
- _initOb() : mixed
- Do initialization tasks.
Properties
$_logger
Logger.
protected
Horde_Log_Logger
$_logger
$_params
Parameters.
protected
array<string|int, mixed>
$_params
= array()
$_cache
Storage for this cache.
private
array<string|int, mixed>
$_cache
= array()
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
Configuration parameters.
Return values
mixed —__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —clear()
Clears all data from the cache.
public
abstract clear() : mixed
Tags
Return values
mixed —exists()
Checks if a given key exists in the cache, valid for the given lifetime.
public
abstract exists(string $key, int $lifetime) : bool
Parameters
- $key : string
-
Cache key to check.
- $lifetime : int
-
Lifetime of the key in seconds.
Return values
bool —Existence.
expire()
Expire any existing data for the given key.
public
abstract expire(string $key) : bool
Parameters
- $key : string
-
Cache key to expire.
Return values
bool —Success or failure.
get()
Retrieve cached data.
public
abstract get(string $key, int $lifetime) : mixed
Parameters
- $key : string
-
Object ID to query.
- $lifetime : int
-
Lifetime of the object in seconds.
Return values
mixed —Cached data, or false if none was found.
serialize()
public
serialize() : mixed
Return values
mixed —set()
Store an object in the cache.
public
abstract set(string $key, mixed $data, int $lifetime) : mixed
Parameters
- $key : string
-
Object ID used as the caching key.
- $data : mixed
-
Data to store in the cache.
- $lifetime : int
-
Object lifetime - i.e. the time before the data becomes available for garbage collection. If 0 will not be GC'd.
Return values
mixed —setLogger()
Set the logging object.
public
setLogger(Horde_Log_Logger $logger) : mixed
Parameters
- $logger : Horde_Log_Logger
-
Log object.
Return values
mixed —unserialize()
public
unserialize(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —_initOb()
Do initialization tasks.
protected
_initOb() : mixed