Remove Horde_Core dependency for Cache; phpdoc
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 25 Mar 2010 19:50:36 +0000 (13:50 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 25 Mar 2010 19:51:30 +0000 (13:51 -0600)
framework/Cache/lib/Horde/Cache.php
framework/Cache/lib/Horde/Cache/Apc.php
framework/Cache/lib/Horde/Cache/Base.php
framework/Cache/lib/Horde/Cache/Eaccelerator.php
framework/Cache/lib/Horde/Cache/File.php
framework/Cache/lib/Horde/Cache/Memcache.php
framework/Cache/lib/Horde/Cache/Null.php
framework/Cache/lib/Horde/Cache/Sql.php
framework/Cache/lib/Horde/Cache/Xcache.php
framework/Cache/lib/Horde/Cache/Zps4.php
framework/Core/lib/Horde/Core/Binder/Cache.php

index ea6bdf9..347166c 100644 (file)
@@ -9,9 +9,10 @@
  * 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
 {
index c73a2d2..1416cc1 100644 (file)
@@ -8,8 +8,9 @@
  * 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
 {
index d862587..5b2a468 100644 (file)
@@ -8,10 +8,11 @@
  * 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
 {
@@ -20,7 +21,9 @@ abstract class Horde_Cache_Base
      *
      * @var array
      */
-    protected $_params = array();
+    protected $_params = array(
+        'lifetime' => 86400
+    );
 
     /**
      * Logger.
@@ -41,18 +44,12 @@ abstract class Horde_Cache_Base
      */
     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);
     }
 
     /**
index 4ffc095..e177d95 100644 (file)
@@ -8,8 +8,9 @@
  * 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
 {
index 55afadc..7da3938 100644 (file)
  * 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
 {
index 2bf20ae..ffb9b58 100644 (file)
@@ -3,12 +3,6 @@
  * 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/)
  *
@@ -18,7 +12,7 @@
  * @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
 {
@@ -38,7 +32,10 @@ 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
      */
index 3a05c6b..06028fe 100644 (file)
@@ -8,8 +8,9 @@
  * 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
 {
index 0cf615d..38d9fee 100644 (file)
@@ -3,31 +3,6 @@
  * 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
 {
@@ -86,7 +62,33 @@ 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())
     {
index 861ec11..cec76ab 100644 (file)
@@ -8,15 +8,19 @@
  * 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())
     {
index 11787de..2e27d4b 100644 (file)
@@ -8,8 +8,9 @@
  * 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
 {
index 4dfaead..3b2d34c 100644 (file)
@@ -31,6 +31,10 @@ class Horde_Core_Binder_Cache implements Horde_Injector_Binder
             }
         }
 
+        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);