On this page
Class CacheSession
CacheSession provides method for saving sessions into a Cache engine. Used with Session
Property Summary
-
$_options protected
array<string, mixed>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
No-op method. Always returns 0 since cache engine don't have garbage collection.
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<string, mixed> $config = [])
Constructor.
Parameters
array<string, mixed>$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
InvalidArgumentExceptionif the 'config' key is not provided
close() public
close(): bool
Method called on close of a database session.
Returns
booldestroy() public
destroy(string $id): bool
Method called on the destruction of a cache session.
Parameters
string$id-
ID that uniquely identifies session in cache.
Returns
boolgc() public
gc(int $maxlifetime): int|false
No-op method. Always returns 0 since cache engine don't have garbage collection.
Parameters
int$maxlifetime-
Sessions that have not updated for the last maxlifetime seconds will be removed.
Returns
int|falseopen() public
open(string $path, string $name): bool
Method called on open of a database session.
Parameters
string$path-
The path where to store/retrieve the session.
string$name-
The session name.
Returns
boolread() public
read(string $id): string|false
Method used to read from a cache session.
Parameters
string$id-
ID that uniquely identifies session in cache.
Returns
string|falsewrite() public
write(string $id, string $data): bool
Helper function called on write for cache sessions.
Parameters
string$id-
ID that uniquely identifies session in cache.
string$data-
The data to be saved.
Returns
boolProperty Detail
$_options protected
Options for this session engine
Type
array<string, mixed>© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Http.Session.CacheSession.html