AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Handler;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\SessionMapper;use Laminas\Session\SaveHandler\SaveHandlerInterface;use SessionHandlerInterface;class SessionCacheHandler implements SaveHandlerInterface{/**** @var \LeadersLinked\Cache\CacheInterface*/private $cache;/**** @param \LeadersLinked\Cache\CacheInterface* @param int $session_lifetime*/public function __construct($cache){$this->cache = $cache;}/**** {@inheritDoc}* @see SessionHandlerInterface::close()*/public function close() : bool{return true;}/**** {@inheritDoc}* @see SessionHandlerInterface::destroy()*/public function destroy(string $id) : bool{$this->cache->removeItem($id);return true;}/**** {@inheritDoc}* @see SessionHandlerInterface::gc()*/public function gc(int $max_lifetime) : int{return 0;}/**** {@inheritDoc}* @see SessionHandlerInterface::open()*/public function open(string $path, string $name) : bool{return true;}/**** {@inheritDoc}* @see SessionHandlerInterface::read()*/public function read(string $id) : string{return $this->cache->getItem($id);}/**** {@inheritDoc}* @see SessionHandlerInterface::write()*/public function write(string $id, string $data) : bool{return $this->cache->setItem($id, $data);}}