Author: Michael Slusarz (slusarz@horde.org)
Inheritance: implements Serializable
Exemple #1
0
 /**
  * Constructor.
  *
  * @param Horde_Cache_Storage $storage  The storage object.
  * @param array $params                 Parameter array:
  * <pre>
  *   - 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.
  * </pre>
  */
 public function __construct(Horde_Cache_Storage_Base $storage, array $params = array())
 {
     if (isset($params['logger'])) {
         $this->_logger = $params['logger'];
         unset($params['logger']);
         $storage->setLogger($this->_logger);
     }
     $this->_params = array_merge($this->_params, $params);
     $this->_storage = $storage;
 }
Exemple #2
0
 /**
  * Constructor.
  *
  * @param array $params  Optional parameters:
  * <pre>
  *   - prefix: (string) The prefix to use for the cache keys.
  *             DEFAULT: ''
  * </pre>
  *
  * @throws Horde_Cache_Exception
  */
 public function __construct(array $params = array())
 {
     if (!function_exists('eaccelerator_gc')) {
         throw new Horde_Cache_Exception('eAccelerator must be compiled with support for shared memory to use as caching backend.');
     }
     parent::__construct(array_merge(array('prefix' => ''), $params));
 }
Exemple #3
0
 /**
  * Constructor.
  *
  * @param array $params  Parameters:
  * <pre>
  *   - stack: (array) [REQUIRED] An array of storage instances to loop
  *            through, in order of priority. The last entry is considered
  *            the 'master' driver, for purposes of writes.
  * </pre>
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['stack'])) {
         throw new InvalidArgumentException('Missing stack parameter.');
     }
     parent::__construct($params);
 }
Exemple #4
0
 /**
  * @param array $params  Additional parameters:
  * <pre>
  *   - hashtable: (Horde_HashTable) [REQUIRED] A Horde_HashTable object.
  *   - prefix: (string) The prefix to use for the cache keys.
  *             DEFAULT: ''
  * </pre>
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['hashtable'])) {
         throw new InvalidArgumentException('Missing hashtable parameter.');
     }
     parent::__construct(array_merge(array('prefix' => ''), $params));
 }
Exemple #5
0
 /**
  * Constructor.
  *
  * @param array $params  Parameters:
  * <pre>
  *   - collection: (string) The collection name.
  *   - mongo_db: [REQUIRED] (Horde_Mongo_Client) A MongoDB client object.
  * </pre>
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['mongo_db'])) {
         throw new InvalidArgumentException('Missing mongo_db parameter.');
     }
     parent::__construct(array_merge(array('collection' => 'horde_cache'), $params));
 }
Exemple #6
0
 /**
  * @param array $params  Configuration parameters:
  *   - app: (string) Application to store session data under.
  *   - cache: (Horde_Cache) [REQUIRED] The backend cache driver used to
  *            store large entries.
  *   - maxsize: (integer) The maximum size of the data to store in the
  *              session (0 to always store in session).
  *   - storage_key: (string) The storage key to save the session data
  *                  under.
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['cache'])) {
         throw new InvalidArgumentException('Missing cache parameter.');
     }
     parent::__construct(array_merge(array('app' => 'horde', 'maxsize' => 5000, 'storage_key' => 'sess_cache'), $params));
 }
Exemple #7
0
 /**
  * Constructor.
  *
  * @param array $params  Optional parameters:
  * <pre>
  *   - dir: (string) The base directory to store the cache files in.
  *          DEFAULT: System default
  *   - no_gc: (boolean) If true, don't perform garbage collection.
  *            DEFAULT: false
  *   - prefix: (string) The filename prefix to use for the cache files.
  *             DEFAULT: 'cache_'
  *   - sub: (integer) If non-zero, the number of subdirectories to create
  *          to store the file (i.e. PHP's session.save_path).
  *          DEFAULT: 0
  * </pre>
  */
 public function __construct(array $params = array())
 {
     $params = array_merge(array('prefix' => 'cache_', 'sub' => 0), $params);
     if (!isset($params['dir']) || !@is_dir($params['dir'])) {
         $params['dir'] = sys_get_temp_dir();
     }
     parent::__construct($params);
 }
Exemple #8
0
 /**
  * Construct a new Horde_Cache_Memcache object.
  *
  * @param array $params  Parameter array:
  * <pre>
  *   - memcache: (Horde_Memcache) [REQUIRED] A Horde_Memcache object.
  *   - prefix: (string) The prefix to use for the cache keys.
  *             DEFAULT: ''
  * </pre>
  */
 public function __construct(array $params = array())
 {
     if (!isset($params['memcache'])) {
         if (isset($params['hashtable'])) {
             $params['memcache'] = $params['hashtable'];
         } else {
             throw new InvalidArgumentException('Missing memcache object');
         }
     }
     parent::__construct(array_merge(array('prefix' => ''), $params));
 }
Exemple #9
0
 /**
  * Constructor.
  *
  * @param array $params  Optional parameters:
  * <pre>
  *   - prefix: (string) The prefix to use for the cache keys.
  *             DEFAULT: ''
  * </pre>
  */
 public function __construct(array $params = array())
 {
     parent::__construct(array_merge(array('prefix' => ''), $params));
 }
Exemple #10
0
 /**
  * Constructor.
  *
  * @param array $params  Optional parameters:
  * <pre>
  *   - session: (string) Store session data in this entry.
  *              DEFAULT: 'horde_cache_session'
  * </pre>
  */
 public function __construct(array $params = array())
 {
     $params = array_merge(array('sess_name' => 'horde_cache_session'), $params);
     parent::__construct($params);
 }