Esempio n. 1
0
 /**
  * Delete old set or throw exception
  *
  * @throws Rediska_Connection_Exec_Exception
  * @param Rediska_Connection_Exec_Exception $e
  * @return void
  */
 protected function _deleteSetOrThrowException(Rediska_Connection_Exec_Exception $e)
 {
     if ($e->getMessage() == 'Operation against a key holding the wrong kind of value') {
         $this->_set->delete();
     } else {
         throw $e;
     }
 }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
 /**
  * Set Redis session save handler
  * 
  * @param Rediska_Zend_Session_SaveHandler_Redis $saveHandler
  * @return boolean
  */
 public static function setSaveHandler(Rediska_Zend_Session_SaveHandler_Redis $saveHandler)
 {
     self::$_saveHandler = $saveHandler;
     return true;
 }