PHP Class Horde_Cache, horde

Author: Anil Madhavapeddy ([email protected])
Author: Chuck Hagenbuch ([email protected])
Author: Michael Slusarz ([email protected])
Mostrar archivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_logger Horde_Log_Logger Logger.
$_params array Cache parameters.
$_storage Horde_Cache_Storage Storage object.

Public Methods

Method Description
__construct ( Horde_Cache_Storage_Base $storage, array $params = [] ) Constructor.
clear ( ) Clears all data from the cache.
exists ( string $key, integer $lifetime = 1 ) : boolean Checks if a given key exists in the cache, valid for the given lifetime.
expire ( string $key ) : boolean Expire any existing data for the given key.
get ( string $key, integer $lifetime = 1 ) : mixed Retrieve cached data.
output ( string $key, integer $lifetime = 1 ) : boolean Attempts to directly output a cached object.
set ( string $key, string $data, integer $lifetime = null ) Store an object in the cache.
testReadWrite ( ) : boolean Tests the driver for read/write access.

Method Details

__construct() public method

Constructor.
public __construct ( Horde_Cache_Storage_Base $storage, array $params = [] )
$storage Horde_Cache_Storage_Base The storage object.
$params 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.

clear() public method

Clears all data from the cache.
public clear ( )

exists() public method

Checks if a given key exists in the cache, valid for the given lifetime.
public exists ( string $key, integer $lifetime = 1 ) : boolean
$key string Cache key to check.
$lifetime integer Lifetime of the key in seconds.
return boolean Existence.

expire() public method

Expire any existing data for the given key.
public expire ( string $key ) : boolean
$key string Cache key to expire.
return boolean Success or failure.

get() public method

Retrieve cached data.
public get ( string $key, integer $lifetime = 1 ) : mixed
$key string Object ID to query.
$lifetime integer Lifetime of the object in seconds.
return mixed Cached data, or false if none was found.

output() public method

Attempts to directly output a cached object.
public output ( string $key, integer $lifetime = 1 ) : boolean
$key string Object ID to query.
$lifetime integer Lifetime of the object in seconds.
return boolean True if output or false if no object was found.

set() public method

Store an object in the cache.
public set ( string $key, string $data, integer $lifetime = null )
$key string Object ID used as the caching key.
$data string Data to store in the cache.
$lifetime integer 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.

testReadWrite() public method

Tests the driver for read/write access.
public testReadWrite ( ) : boolean
return boolean True if read/write is available.

Property Details

$_logger protected_oe property

Logger.
protected Horde_Log_Logger $_logger
return Horde_Log_Logger

$_params protected_oe property

Cache parameters.
protected array $_params
return array

$_storage protected_oe property

Storage object.
protected Horde_Cache_Storage $_storage
return Horde_Cache_Storage