NAME
Dancer2::Session::DBI - DBI based session engine for Dancer
VERSION
Version 0.01
SYNOPSIS
This is a more or less faithful port of Dancer::Session::DBI to Dancer2. It implements a session engine by serializing the session and storing it in a database via DBI. The only supported serialization method is JSON.
This was, so far, only tested with PostgreSQL but should in theory work with MySQL and SQLite as well, as we inherit the handling of these databases from the original module.
USAGE
In config.yml
session: 'DBI'
engines:
session:
DBI:
dsn: "dbi:Pg:dbname=testing;host=127.0.0.1"
dbtable: "sessions"
dbuser: "user"
dbpass: "password"
The table needs to have at least id
and a session_data
columns.
A timestamp field that updates when a session is updated is recommended, so you can expire sessions server-side as well as client-side.
This session engine will not automagically remove expired sessions on the server, but with a timestamp field as above, you should be able to do it manually.
SEE ALSO
Dancer2, Dancer2::Session, Dancer::Session
ACKNOWLEDGEMENTS
This module is based on Dancer::Session::DBI by James Aitken <jaitken@cpan.org>
LICENSE AND COPYRIGHT
This software is Copyright (c) 2024 by Dennis Lichtenthäler.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)