* @param string $key Cache key (identifier).
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
$key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
apc_store($key . '_expire', time(), $lifetime);
- return apc_store($key, $data, $lifetime);
+ apc_store($key, $data, $lifetime);
}
/**
* data becomes available for garbage
* collection. If null use the default Horde GC
* time. If 0 will not be GC'd.
- *
- * @return boolean True on success, false on failure.
*/
abstract public function set($key, $data, $lifetime = null);
* @param string $key Cache key (identifier).
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
$key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
eaccelerator_put($key . '_expire', time(), $lifetime);
- return eaccelerator_put($key, $data, $lifetime);
+ eaccelerator_put($key, $data, $lifetime);
}
/**
* @param string $key Cache key.
* @param mixed $data Data to store in the cache. (MUST BE A STRING)
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
}
if (file_put_contents($tmp_file, $data) === false) {
- return false;
+ return;
}
@rename($tmp_file, $filename);
fwrite($fp, $filename . "\t" . (empty($lifetime) ? 0 : time() + $lifetime) . "\n");
fclose($fp);
}
-
- return true;
}
/**
* @param string $key Cache key.
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
$key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
- return ($this->_memcache->set($key . '_e', time(), $lifetime) === false)
- ? false
- : $this->_memcache->set($key, $data, $lifetime);
+ if ($this->_memcache->set($key . '_e', time(), $lifetime) !== false) {
+ $this->_memcache->set($key, $data, $lifetime);
+ }
}
/**
* @param string $key Cache key (identifier).
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
* @param string $key Cache key (identifier).
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
- return false;
}
/**
* @param mixed $data Data to store in the cache. (MUST BE A STRING)
* @param integer $lifetime Maximum data life span or 0 for a
* non-expiring object.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
? 0
: $this->_getLifetime($lifetime) + $timestamp;
- if ($this->_logger) {
- $this->_logger->log(sprintf('Cache set: %s (Id %s set at %d expires at %d)', $okey, $key, $timestamp, $expiration), 'DEBUG');
- }
+ if ($this->_logger) {
+ $this->_logger->log(sprintf('Cache set: %s (Id %s set at %d expires at %d)', $okey, $key, $timestamp, $expiration), 'DEBUG');
+ }
// Remove any old cache data and prevent duplicate keys
$query = 'DELETE FROM ' . $this->_params['table'] . ' WHERE cache_id=?';
$values = array($key);
try {
- $this->_db->query($query, $values);
+ $this->_db->delete($query, $values);
} catch (Horde_Db_Exception $e) {}
/* Build SQL query. */
$values = array($key, $timestamp, $expiration, $data);
try {
- $this->_db->query($query, $values);
- } catch (Horde_Db_Exception $e) {
- return false;
- }
-
- return true;
+ $this->_db->insert($query, $values);
+ } catch (Horde_Db_Exception $e) {}
}
/**
* data becomes available for garbage
* collection. If null use the default Horde GC
* time. If 0 will not be GC'd.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
$result = $val->set($key, $data, $lifetime);
if ($result === false) {
if ($master) {
- return false;
+ return;
}
/* Attempt to invalidate cache if write failed. */
}
$master = false;
}
-
- return true;
}
/**
* @param string $key Cache key (identifier).
* @param mixed $data Data to store in the cache.
* @param integer $lifetime Data lifetime.
- *
- * @return boolean True on success, false on failure.
*/
public function set($key, $data, $lifetime = null)
{
$key = $this->_params['prefix'] . $key;
$lifetime = $this->_getLifetime($lifetime);
xcache_set($key . '_expire', time(), $lifetime);
- return xcache_set($key, $data, $lifetime);
+ xcache_set($key, $data, $lifetime);
}
/**
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Added Horde_Cache_Exception::.
+ <notes>* Horde_Cache_Base::set() no longer returns a boolean result.
+ * Added Horde_Cache_Exception::.
* Removed dependency on Horde Core.
* Initial Horde 4 package.</notes>
<contents>
protected function shutdown()
{
$data = @serialize($this);
- return $this->_cache->set($signature, $data,
- $GLOBALS['conf']['kolab']['storage']['cache']['folders']['lifetime']);
+ $this->_cache->set($signature, $data,
+ $GLOBALS['conf']['kolab']['storage']['cache']['folders']['lifetime']);
}
/**
*/
public function storeAttachment($key, $data)
{
- return $this->horde_cache->set($key, $data);
+ $this->horde_cache->set($key, $data);
+ return true;
}
/**
if ($force || is_null($this->_template)) {
$this->_template = str_replace("\n", " \n", file_get_contents($file));
$this->_parse();
- if ($this->_cache &&
- isset($cacheid) &&
- !$this->_cache->set($cacheid, $this->_template) &&
- $this->_logger) {
- $this->_logger->log(sprintf('Could not save the compiled template file "%s".', $file), 'ERR');
+ if ($this->_cache && isset($cacheid)) {
+ $this->_cache->set($cacheid, $this->_template);
+ if ($this->_logger) {
+ $this->_logger->log(sprintf('Saved compiled template file for "%s".', $file), 'DEBUG');
+ }
}
}