コード例 #1
0
ファイル: Redis.php プロジェクト: npestcova/currencyRate
 /**
  * Destroy session
  *
  * @param string $id
  * @return boolean
  */
 public function destroy($id)
 {
     try {
         $this->_set->remove($id);
     } catch (Rediska_Connection_Exec_Exception $e) {
         $this->_deleteSetOrThrowException($e);
     }
     return $this->getRediska()->delete($this->_getKeyName($id));
 }
コード例 #2
0
ファイル: Redis.php プロジェクト: utachkin/Rediska
 /**
  * Garbage Collection
  *
  * @param int $maxlifetime
  * @return true
  */
 public function gc($maxlifetime)
 {
     $sessions = $this->_set->toArray();
     foreach ($sessions as &$session) {
         $session = $this->_getKeyName($session);
     }
     // TODO: May by use TTL? Need benchmark.
     $lifeSession = $this->_rediska->get($sessions);
     foreach ($sessions as $session) {
         if (!isset($lifeSession[$session])) {
             $sessionWithoutPrefix = substr($session, strlen($this->_options['keyprefix']));
             $this->_set->remove($sessionWithoutPrefix);
         }
     }
     return true;
 }