MVC::Neaf::X::Session::SQL - SQL-based session backend for Not Even A Framework.
Store session data in a SQL table. Consider a pre-existing DB connection and a low-traffic site where having additional session storage (e.g. key-value) would be an overkill.
my $session_engine = MVC::Neaf::X::Session::SQL->new ( dbh => $my_db_conn, table => 'session', id_as => 'session_name', content_as => 'json_data', # optional but recommended expire_as => 'expires', # optional, unix timestamp mapped_cols => [ 'user_id', ... ], # optional );
%options may include
dbh (required) - database connection to use, see DBI.
table (required) - name of table to use for sessions.
id_as (required) - name of session id column. Must accept long arbitrary strings.
content_as - name of column containing encoded session data. Must accept long arbitrary strings.
expire_as - name of column storing expiration date as a Unix timestamp (must accept integer number).
mapped_cols - array of session fields that are mapped into database columns. The field name MUST be equal to column name.
At least one of content_as and mapped_cols MUST be present, even though it could be technically possible to use sessions with id and timestamp only.
Store data in database, using $hash as additional indexed fields if any defined.
Fetch data from table.
Returns { data => stringified_data, orevvide => { individual_fields } }
This module is part of MVC::Neaf suite.
Copyright 2016-2018 Konstantin S. Uvarin khedin@cpan.org.
khedin@cpan.org
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MVC::Neaf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MVC::Neaf
CPAN shell
perl -MCPAN -e shell install MVC::Neaf
For more information on module installation, please visit the detailed CPAN module installation guide.