Esempio n. 1
0
 /**
  * Retrieve a cached value entry by id.
  * @param   string   id of cache to entry
  * @param   string   default value to return if cache miss
  * @return  mixed
  * @throws  Kohana_Cache_Exception
  */
 public function get($id, $default = NULL)
 {
     $key = $this->_sanitize_id($id);
     if (!$this->_rediska->exists($key)) {
         $value = $default;
     } else {
         $value = $this->_rediska->get($key);
     }
     // Return the value
     return $value;
 }
Esempio n. 2
0
 /**
  *
  * @param type $id
  * @return Session_RedisHash 
  */
 protected function _rename($id)
 {
     if ($this->_rediska->exists($this->_id)) {
         $this->_rediska->rename($this->_id, $id);
     }
     return $this;
 }
 /**
  * Test if a cache is available or not (for the given id)
  *
  * @param string $id cache id
  * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  */
 protected function _doContains($id)
 {
     return $this->_rediska->exists($id);
 }
 /**
  * @see sfCache
  */
 public function has($key)
 {
     return $this->_rediska->exists($this->getKey($key));
 }