for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Wandu\Http\Session\Handler;
use Predis\Client;
use SessionHandlerInterface;
class RedisHandler implements SessionHandlerInterface
{
/** @var \Predis\Client */
private $client;
/** @var int */
private $expire;
/**
* @param \Predis\Client $client
* @param int $expire
*/
public function __construct(Client $client, $expire = 1800)
$this->client = $client;
$this->expire = $expire;
}
* {@inheritdoc}
public function destroy($sessionId)
$this->client->del("wandu.http.sess.{$sessionId}");
public function read($sessionId)
if ($dataSet = $this->client->get("wandu.http.sess.{$sessionId}")) {
return $dataSet;
return '';
public function write($sessionId, $dataSet)
$this->client->set("wandu.http.sess.{$sessionId}", $dataSet);
$this->client->expire("wandu.http.sess.{$sessionId}", $this->expire);
public function gc($maxlifetime)
return true;
public function open($savePath, $sessionId)
public function close()