/usr/share/php/Horde/Cache/Storage/Base.php is in php-horde-cache 2.5.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | <?php
/**
* Copyright 2010-2016 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.
*
* @category Horde
* @copyright 2010-2016 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Cache
*/
/**
* The abstract implementation of the cache storage driver.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2010-2016 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Cache
*/
abstract class Horde_Cache_Storage_Base implements Serializable
{
/**
* Logger.
*
* @var Horde_Log_Logger
*/
protected $_logger;
/**
* Parameters.
*
* @var array
*/
protected $_params = array();
/**
* Constructor.
*
* @param array $params Configuration parameters.
*/
public function __construct(array $params = array())
{
$this->_params = array_merge($this->_params, $params);
$this->_initOb();
}
/**
* Do initialization tasks.
*/
protected function _initOb()
{
}
/**
* Set the logging object.
*
* @param Horde_Log_Logger $logger Log object.
*/
public function setLogger($logger)
{
$this->_logger = $logger;
}
/**
* Retrieve cached data.
*
* @param string $key Object ID to query.
* @param integer $lifetime Lifetime of the object in seconds.
*
* @return mixed Cached data, or false if none was found.
*/
abstract public function get($key, $lifetime = 0);
/**
* Store an object in the cache.
*
* @param string $key Object ID used as the caching key.
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Object lifetime - i.e. the time before the
* data becomes available for garbage
* collection. If 0 will not be GC'd.
*/
abstract public function set($key, $data, $lifetime = 0);
/**
* Checks if a given key exists in the cache, valid for the given
* lifetime.
*
* @param string $key Cache key to check.
* @param integer $lifetime Lifetime of the key in seconds.
*
* @return boolean Existence.
*/
abstract public function exists($key, $lifetime = 0);
/**
* Expire any existing data for the given key.
*
* @param string $key Cache key to expire.
*
* @return boolean Success or failure.
*/
abstract public function expire($key);
/**
* Clears all data from the cache.
*
* @throws Horde_Cache_Exception
*/
abstract public function clear();
/* Serializable methods. */
/**
*/
public function serialize()
{
return serialize(array(
$this->_params,
$this->_logger
));
}
/**
*/
public function unserialize($data)
{
@list($this->_params, $this->_logger) = @unserialize($data);
$this->_initOb();
}
}
|