Overview

Packages

  • Cache

Classes

  • Horde_Cache
  • Horde_Cache_Exception
  • Horde_Cache_Storage_Apc
  • Horde_Cache_Storage_Base
  • Horde_Cache_Storage_Eaccelerator
  • Horde_Cache_Storage_File
  • Horde_Cache_Storage_Memcache
  • Horde_Cache_Storage_Mock
  • Horde_Cache_Storage_Null
  • Horde_Cache_Storage_Session
  • Horde_Cache_Storage_Sql
  • Horde_Cache_Storage_Stack
  • Horde_Cache_Storage_Xcache
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Cache

This class provides the API interface to the cache storage drivers.

Copyright 1999-2012 Horde LLC (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Package: Cache
Category: Horde
License: LGPL 2.1
Author: Anil Madhavapeddy anil@recoil.org
Author: Chuck Hagenbuch chuck@horde.org
Author: Michael Slusarz slusarz@horde.org
Located at Horde/Cache.php
Methods summary
public
# __construct( Horde_Cache_Storage_Base $storage, array $params = array() )

Constructor.

Constructor.

Parameters

$storage
The storage object.
$params
Parameter array: <pre><span class="php-quote">'compress'</span> - (boolean) Compress data? Requires the <span class="php-quote">'lzf'</span> PECL extension. <span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span> <span class="php-quote">'lifetime'</span> - (integer) Lifetime of data, in seconds. <span class="php-keyword1">DEFAULT</span>: <span class="php-num">86400</span> seconds <span class="php-quote">'logger'</span> - (Horde_Log_Logger) <span class="php-keyword2">Log</span> object to <span class="php-keyword1">use</span> <span class="php-keyword1">for</span> <span class="php-keyword2">log</span>/debug messages.</pre>
public boolean
# output( string $key, integer $lifetime = 1 )

Attempts to directly output a cached object.

Attempts to directly output a cached object.

Parameters

$key
Object ID to query.
$lifetime
Lifetime of the object in seconds.

Returns

boolean
True if output or false if no object was found.
public mixed
# get( string $key, integer $lifetime = 1 )

Retrieve cached data.

Retrieve cached data.

Parameters

$key
Object ID to query.
$lifetime
Lifetime of the object in seconds.

Returns

mixed
Cached data, or false if none was found.
public
# set( string $key, string $data, integer $lifetime = null )

Store an object in the cache.

Store an object in the cache.

Parameters

$key
Object ID used as the caching key.
$data
Data to store in the cache.
$lifetime
<p>Object lifetime - i.e. the time before the data becomes available for garbage collection. If null use the default Horde GC time. If 0 will not be GC'd.</p>
public boolean
# exists( string $key, integer $lifetime = 1 )

Checks if a given key exists in the cache, valid for the given lifetime.

Checks if a given key exists in the cache, valid for the given lifetime.

Parameters

$key
Cache key to check.
$lifetime
Lifetime of the key in seconds.

Returns

boolean
Existence.
public boolean
# expire( string $key )

Expire any existing data for the given key.

Expire any existing data for the given key.

Parameters

$key
Cache key to expire.

Returns

boolean
Success or failure.
public
# clear( )

Clears all data from the cache.

Clears all data from the cache.

Throws

Horde_Cache_Exception
API documentation generated by ApiGen