for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nofw\Session;
use Psr\SimpleCache\CacheInterface;
use Psr\SimpleCache\InvalidArgumentException;
/**
* PSR-16 Session handler implementation.
*
* @author Márk Sági-Kazár <[email protected]>
*/
final class SimpleCacheSessionHandler implements \SessionHandlerInterface
{
* @var CacheInterface
private $cache;
* @param CacheInterface $cache
public function __construct(CacheInterface $cache)
$this->cache = $cache;
}
* {@inheritdoc}
public function close()
return true;
public function destroy($session_id)
try {
return $this->cache->delete($session_id);
} catch (InvalidArgumentException $e) {
return false;
public function gc($maxlifetime)
public function open($save_path, $name)
public function read($session_id)
return $this->cache->get($session_id);
return '';
public function write($session_id, $session_data)
return $this->cache->set($session_id, $session_data);