/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Http/Session
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Http/Session/CacheSession.php (3737B)
*/
protected $_options = [];
/**
* Constructor.
*
* @param array
$config The configuration to use for this engine
* It requires the key 'config' which is the name of the Cache config to use for
* storing the session
* @throws \InvalidArgumentException if the 'config' key is not provided
*/
public function __construct(array $config = [])
{
if (empty($config['config'])) {
throw new InvalidArgumentException('The cache configuration name to use is required');
}
$this->_options = $config;
}
/**
* Method called on open of a database session.
*
* @param string $path The path where to store/retrieve the session.
* @param string $name The session name.
* @return bool Success
*/
public function open($path, $name): bool
{
return true;
}
/**
* Method called on close of a database session.
*
* @return bool Success
*/
public function close(): bool
{
return true;
}
/**
* Method used to read from a cache session.
*
* @param string $id ID that uniquely identifies session in cache.
* @return string|false Session data or false if it does not exist.
*/
#[\ReturnTypeWillChange]
public function read($id)
{
$value = Cache::read($id, $this->_options['config']);
if ($value === null) {
return '';
}
return $value;
}
/**
* Helper function called on write for cache sessions.
*
* @param string $id ID that uniquely identifies session in cache.
* @param string $data The data to be saved.
* @return bool True for successful write, false otherwise.
*/
public function write($id, $data): bool
{
if (!$id) {
return false;
}
return Cache::write($id, $data, $this->_options['config']);
}
/**
* Method called on the destruction of a cache session.
*
* @param string $id ID that uniquely identifies session in cache.
* @return bool Always true.
*/
public function destroy($id): bool
{
Cache::delete($id, $this->_options['config']);
return true;
}
/**
* No-op method. Always returns 0 since cache engine don't have garbage collection.
*
* @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
* @return int|false
*/
#[\ReturnTypeWillChange]
public function gc($maxlifetime)
{
return 0;
}
}