Class CacheSession
CacheSession provides method for saving sessions into a Cache engine. Used with Session
Property Summary
-
$_options protected
array
Options for this session engine
Method Summary
-
__construct() public
Constructor.
-
close() public
Method called on close of a database session.
-
destroy() public
Method called on the destruction of a cache session.
-
gc() public
Helper function called on gc for cache sessions.
-
open() public
Method called on open of a database session.
-
read() public
Method used to read from a cache session.
-
write() public
Helper function called on write for cache sessions.
Method Detail
__construct() ¶ public
__construct(array $config = [])
Constructor.
Parameters
-
array
$config optional 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
destroy() ¶ public
destroy(string|int $id): bool
Method called on the destruction of a cache session.
Parameters
-
string|int
$id ID that uniquely identifies session in cache.
Returns
bool
gc() ¶ public
gc(int $maxlifetime): bool
Helper function called on gc for cache sessions.
Parameters
-
int
$maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
Returns
bool
open() ¶ public
open(string $savePath, string $name): bool
Method called on open of a database session.
Parameters
-
string
$savePath The path where to store/retrieve the session.
-
string
$name The session name.
Returns
bool
read() ¶ public
read(string|int $id): string
Method used to read from a cache session.
Parameters
-
string|int
$id ID that uniquely identifies session in cache.
Returns
string
write() ¶ public
write(string|int $id, mixed $data): bool
Helper function called on write for cache sessions.
Parameters
-
string|int
$id ID that uniquely identifies session in cache.
-
mixed
$data The data to be saved.
Returns
bool