Example #1
0
 public function append($key, $data)
 {
     try {
         return $this->instance->append($key, $data);
     } catch (BaseException $e) {
         return $this->alive = false;
     }
 }
 /**
  * Write data for key into cache. When using memcache as your cache engine
  * remember that the Memcache pecl extension does not support cache expiry times greater
  * than 30 days in the future. Any duration greater than 30 days will be treated as never expiring.
  *
  * @param string $key Identifier for the data
  * @param mixed $value Data to be cached
  * @param int $duration How long to cache the data, in seconds
  * @return bool True if the data was successfully cached, false on failure
  * @see http://php.net/manual/en/memcache.set.php
  */
 public function write($key, $value, $duration)
 {
     if ($duration > 30 * DAY) {
         $duration = 0;
     }
     $this->_Memcached->append($this->_keys, str_replace($this->settings['prefix'], '', $this->_keySeparator . $key));
     return $this->_Memcached->set($key, $value, $duration);
 }