예제 #1
0
 protected function _write()
 {
     if ($this->_lifetime > 0) {
         return $this->_rediska->setAndExpire($this->id(), $this->_data, $this->_lifetime);
     } else {
         return $this->_rediska->set($this->id(), $this->_data);
     }
 }
예제 #2
0
 /**
  * Delete a cache entry based on id
  * @param   string   id of entry to delete
  * @param   integer  timeout of entry, if zero item is deleted immediately, otherwise the item will delete after the specified value in seconds
  * @return  boolean
  */
 public function delete($id, $timeout = 0)
 {
     $key = $this->_sanitize_id($id);
     if ($timeout == 0) {
         $this->_rediska->delete($key);
     } else {
         $this->_rediska->setAndExpire($key, $this->get($id), $timeout);
     }
     return true;
 }
예제 #3
0
 /**
  * Delete a cache entry based on id
  * @param   string   id of entry to delete
  * @param   integer  timeout of entry, if zero item is deleted immediately, otherwise the item will delete after the specified value in seconds
  * @return  boolean
  */
 public function delete($id, $timeout = 0)
 {
     $key = $this->_sanitize_id($id);
     if ($timeout == 0) {
         if (mb_substr($key, -2) == ":*") {
             $key = $this->_rediska->getKeysByPattern($key);
         }
         if ($key) {
             $this->_rediska->delete($key);
         }
     } else {
         $this->_rediska->setAndExpire($key, $this->get($id), $timeout);
     }
     return true;
 }