DatabaseSession provides methods to be used with Session.
\Cake\ORM\Table
Reference to the table handling the session data
\Cake\ORM\Locator\LocatorInterface|null
Table locator instance
int
Number of seconds to mark the session as expired
Constructor. Looks at Session configuration information and sets up the session model.
__construct(array $config)
Constructor. Looks at Session configuration information and sets up the session model.
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.
close()
Method called on close of a database session.
bool
Success
destroy(mixed $id)
Method called on the destruction of a database session.
string
$id ID that uniquely identifies session in database.
bool
True for successful delete, false otherwise.
gc(mixed $maxlifetime)
Helper function called on gc for database sessions.
int
$maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
bool
True on success, false on failure.
getTableLocator()
Gets the table locator.
\Cake\ORM\Locator\LocatorInterface
open(mixed $savePath, mixed $name)
Method called on open of a database session.
string
$savePath The path where to store/retrieve the session.
string
$name The session name.
bool
Success
read(mixed $id)
Method used to read from a database session.
string
$id ID that uniquely identifies session in database.
string
Session data or empty string if it does not exist.
setTableLocator(\Cake\ORM\Locator\LocatorInterface $tableLocator)
Sets the table locator.
\Cake\ORM\Locator\LocatorInterface
$tableLocator LocatorInterface instance.
$this
setTimeout(int $timeout)
Set the timeout value for sessions.
Primarily used in testing.
int
$timeout The timeout duration.
$this
write(mixed $id, mixed $data)
Helper function called on write for database sessions.
string
$id ID that uniquely identifies session in database.
string
$data The data to be saved.
bool
True for successful write, false otherwise.
Reference to the table handling the session data
\Cake\ORM\Table
Table locator instance
\Cake\ORM\Locator\LocatorInterface|null
Number of seconds to mark the session as expired
int
© 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.1/class-Cake.Http.Session.DatabaseSession.html