/**
  * @param string $id
  * @param string $data
  *
  * @return bool
  */
 public function write($id, $data)
 {
     try {
         $key = $this->formatKey($id);
         $this->ssIds[$key] = $this->client->lock($key);
         $this->client->setex($key, ini_get("session.gc_maxlifetime"), $data);
         return TRUE;
     } catch (Exception $e) {
         Debugger::log($e, 'redis-session');
         return FALSE;
     }
 }
Beispiel #2
0
 /**
  * @param string $id
  * @return string
  */
 protected function lock($id)
 {
     try {
         $key = $this->formatKey($id);
         $this->client->lock($key);
         $this->ssIds[$id] = $key;
         return $key;
     } catch (LockException $e) {
         throw new SessionHandlerException(sprintf('Cannot work with non-locked session id %s: %s', $id, $e->getMessage()), 0, $e);
     }
 }
Beispiel #3
0
 /**
  * @param string $key
  * @return void
  */
 public function lock($key)
 {
     if ($this->useLocks) {
         $this->client->lock($this->formatEntryKey($key));
     }
 }