* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Anil Madhavapeddy <anil@recoil.org>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Cache
+ * @author Anil Madhavapeddy <anil@recoil.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache
{
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Duck <duck@obala.net>
- * @package Horde_Cache
+ * @author Duck <duck@obala.net>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Apc extends Horde_Cache_Base
{
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Anil Madhavapeddy <anil@recoil.org>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @author Michael Slusarz <slusarz@horde.org>
- * @package Horde_Cache
+ * @author Anil Madhavapeddy <anil@recoil.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @category Horde
+ * @package Cache
*/
abstract class Horde_Cache_Base
{
*
* @var array
*/
- protected $_params = array();
+ protected $_params = array(
+ 'lifetime' => 86400
+ );
/**
* Logger.
*/
public function __construct($params = array())
{
- if (!isset($params['lifetime'])) {
- $params['lifetime'] = isset($GLOBALS['conf']['cache']['default_lifetime'])
- ? $GLOBALS['conf']['cache']['default_lifetime']
- : 86400;
- }
-
if (isset($params['logger'])) {
$this->_logger = $params['logger'];
unset($params['logger']);
}
- $this->_params = $params;
+ $this->_params = array_merge($this->_params, $params);
}
/**
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Duck <duck@obala.net>
- * @package Horde_Cache
+ * @author Duck <duck@obala.net>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Eaccelerator extends Horde_Cache_Base
{
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Anil Madhavapeddy <anil@recoil.org>
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Cache
+ * @author Anil Madhavapeddy <anil@recoil.org>
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_File extends Horde_Cache_Base
{
* The Horde_Cache_Memcache:: class provides a memcached implementation of the
* Horde caching system.
*
- * Addtional parameters:
- * ---------------------
- * <pre>
- * 'memcache' - (Horde_Memcache) A Horde_Memcache object.
- * </pre>
- *
* Copyright 2006-2007 Duck <duck@obala.net>
* Copyright 2007-2010 The Horde Project (http://www.horde.org/)
*
* @author Duck <duck@obala.net>
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
- * @package Horde_Cache
+ * @package Cache
*/
class Horde_Cache_Memcache extends Horde_Cache_Base
{
/**
* Construct a new Horde_Cache_Memcache object.
*
- * @param array $params Parameter array.
+ * @param array $params Parameter array:
+ * <pre>
+ * 'memcache' - (Horde_Memcache) A Horde_Memcache object.
+ * </pre>
*
* @throws InvalidArgumentException
*/
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Duck <duck@obala.net>
- * @package Horde_Cache
+ * @author Duck <duck@obala.net>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Null extends Horde_Cache_Base
{
* The Horde_Cache_Sql:: class provides a SQL implementation of the Horde
* Caching system.
*
- * Required parameters:<pre>
- * 'phptype' The database type (ie. 'pgsql', 'mysql', etc.).</pre>
- *
- * Required by some database implementations:<pre>
- * 'database' The name of the database.
- * 'hostspec' The hostname of the database server.
- * 'username' The username with which to connect to the database.
- * 'password' The password associated with 'username'.
- * 'options' Additional options to pass to the database.
- * 'tty' The TTY on which to connect to the database.
- * 'port' The port on which to connect to the database.</pre>
- *
- * Optional parameters:<pre>
- * 'table' The name of the cache table in 'database'.
- * Defaults to 'horde_cache'.
- * 'use_memorycache' Use this Horde_Cache:: memory caching object to cache
- * the data (to avoid DB accesses).</pre>
- *
- * Optional values when using separate reading and writing servers, for example
- * in replication settings:<pre>
- * 'splitread' Boolean, whether to implement the separation or not.
- * 'read' Array containing the parameters which are different for
- * the read database connection, currently supported
- * only 'hostspec' and 'port' parameters.</pre>
- *
* The table structure for the cache is as follows:
* <pre>
* CREATE TABLE horde_cache (
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Michael Slusarz <slusarz@curecanti.org>
- * @author Ben Klang <ben@alkaloid.net>
- * @package Horde_Cache
+ * @author Michael Slusarz <slusarz@curecanti.org>
+ * @author Ben Klang <ben@alkaloid.net>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Sql extends Horde_Cache_Base
{
/**
* Constructs a new Horde_Cache_Sql object.
*
- * @param array $params A hash containing configuration parameters.
+ * @param array $params Configuration parameters:
+ * <pre>
+ * Required parameters:
+ * 'phptype' - The database type (ie. 'pgsql', 'mysql', etc.).
+ *
+ * Required by some database implementations:
+ * 'database' - The name of the database.
+ * 'hostspec' - The hostname of the database server.
+ * 'username' - The username with which to connect to the database.
+ * 'password' - The password associated with 'username'.
+ * 'options' - Additional options to pass to the database.
+ * 'tty' - The TTY on which to connect to the database.
+ * 'port' - The port on which to connect to the database.
+ *
+ * Optional parameters:
+ * 'table' - The name of the cache table in 'database'.
+ * DEFAULT: 'horde_cache'.
+ * 'use_memorycache' - Use this Horde_Cache memory caching object to
+ * cache the data (to avoid DB accesses).
+ *
+ * Optional values when using separate reading and writing servers, for
+ * example in replication settings:
+ * 'splitread' - (boolean) Whether to implement the separation.
+ * 'read' - (array) Parameters which are different for the read database
+ * connection, currently supported only 'hostspec' and 'port'
+ * parameters.
+ * </pre>
*/
public function __construct($params = array())
{
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Duck <duck@obala.net>
- * @package Horde_Cache
+ * @author Duck <duck@obala.net>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Xcache extends Horde_Cache_Base
{
/**
* Construct a new Horde_Cache_Xcache object.
*
- * @param array $params Parameter array.
+ * @param array $params Configuration parameters:
+ * <pre>
+ * 'prefix' - (string) TODO
+ * </pre>
*/
public function __construct($params = array())
{
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
- * @author Chuck Hagenbuch <chuck@horde.org>
- * @package Horde_Cache
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ * @category Horde
+ * @package Cache
*/
class Horde_Cache_Zps4 extends Horde_Cache_Base
{
}
}
+ if (isset($GLOBALS['conf']['cache']['default_lifetime'])) {
+ $params['lifetime'] = $GLOBALS['conf']['cache']['default_lifetime'];
+ }
+
$params['logger'] = $injector->getInstance('Horde_Log_Logger');
return Horde_Cache::factory($driver, $params);