DatabaseSession provides methods to be used with Session.
Cake\ORM\TableReference to the table handling the session data
Cake\ORM\Locator\LocatorInterface|nullTable locator instance
intNumber of seconds to mark the session as expired
string|nullThis object's default table alias.
Constructor. Looks at Session configuration information and sets up the session model.
Method called on close of a database session.
Method called on the destruction of a database session.
Convenience method to get a table instance.
Helper function called on gc for database sessions.
Gets the table locator.
Method called on open of a database session.
Method used to read from a database session.
Sets the table locator.
Set the timeout value for sessions.
Helper function called on write for database sessions.
__construct(array<string, mixed> $config = [])
Constructor. Looks at Session configuration information and sets up the session model.
array<string, mixed> $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(): bool
Method called on close of a database session.
booldestroy(string $id): bool
Method called on the destruction of a database session.
string $id ID that uniquely identifies session in database.
boolfetchTable(string|null $alias = null, array<string, mixed> $options = []): Cake\ORM\Table
Convenience method to get a table instance.
string|null $alias optional The alias name you want to get. Should be in CamelCase format. If null then the value of $defaultTable property is used.
array<string, mixed> $options optional The options you want to build the table with. If a table has already been loaded the registry options will be ignored.
Cake\ORM\TableCake\Core\Exception\CakeExceptiongc(int $maxlifetime): int|false
Helper function called on gc for database sessions.
int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
int|falsegetTableLocator(): Cake\ORM\Locator\LocatorInterface
Gets the table locator.
Cake\ORM\Locator\LocatorInterfaceopen(string $path, string $name): bool
Method called on open of a database session.
string $path The path where to store/retrieve the session.
string $name The session name.
boolread(string $id): string|false
Method used to read from a database session.
string $id ID that uniquely identifies session in database.
string|falsesetTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $this
Sets the table locator.
Cake\ORM\Locator\LocatorInterface $tableLocator LocatorInterface instance.
$thissetTimeout(int $timeout): $this
Set the timeout value for sessions.
Primarily used in testing.
int $timeout The timeout duration.
$thiswrite(string $id, string $data): bool
Helper function called on write for database sessions.
string $id ID that uniquely identifies session in database.
string $data The data to be saved.
boolReference to the table handling the session data
Cake\ORM\TableTable locator instance
Cake\ORM\Locator\LocatorInterface|nullNumber of seconds to mark the session as expired
intThis object's default table alias.
string|null
© 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.DatabaseSession.html