Class DatabaseSession
DatabaseSession provides methods to be used with Session.
Property Summary
Method Summary
-
__construct() public
Constructor. Looks at Session configuration information and sets up the session model.
-
close() public
Method called on close of a database session.
-
destroy() public
Method called on the destruction of a database session.
-
gc() public
Helper function called on gc for database sessions.
-
open() public
Method called on open of a database session.
-
read() public
Method used to read from a database session.
-
write() public
Helper function called on write for database sessions.
Method Detail
__construct() ¶ public
__construct(array $config = [])
Constructor. Looks at Session configuration information and sets up the session model.
Parameters
-
array
$config optional The configuration for this engine. It requires the 'model' key to be present corresponding to the Table to use for managing the sessions.
destroy() ¶ public
destroy(int $id): bool
Method called on the destruction of a database session.
Parameters
-
int
$id ID that uniquely identifies session in database
Returns
bool
gc() ¶ public
gc(string $maxlifetime): bool
Helper function called on gc for database sessions.
Parameters
-
string
$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(int|string $id): mixed
Method used to read from a database session.
Parameters
-
int|string
$id The key of the value to read
Returns
mixed
write() ¶ public
write(int $id, mixed $data): bool
Helper function called on write for database sessions.
Parameters
-
int
$id ID that uniquely identifies session in database
-
mixed
$data The value of the data to be saved.
Returns
bool