コード例 #1
0
 /**
  * @param SessionInterface $session
  * @param Response $response
  */
 private function postRequestHandle(SessionInterface $session, Response $response)
 {
     if ($this->sessionIsPersistent($config = $this->manager->getSessionConfig())) {
         $id = $session->getId();
         $key = 'session:' . $id;
         $content = $session->all();
         unset($content['_token'], $content['flash']);
         $lastSeen = time();
         $content['last_seen'] = $lastSeen;
         $session->set('last_seen', $lastSeen);
         $value = Json::dump($content);
         $this->redis->watch($key);
         $this->redis->multi();
         $this->redis->set($key, $value);
         $this->redis->expire($key, $this->getSessionLifetimeInSeconds());
         $this->redis->exec();
         $cookie = new Cookie($this->key, $id, $this->getCookieExpirationDate(), $config['path'], $config['domain'], Arr::get($config, 'secure', false));
         $response->headers->setCookie($cookie);
     }
 }
コード例 #2
0
ファイル: PredisBridge.php プロジェクト: php-resque/resque
 /**
  * {@inheritDoc}
  */
 public function multi()
 {
     return $this->predis->multi();
 }