Egg::Model::Session::Base::DBI - Session management by DBI.
package MyApp::Model::Sesion; __PACKAGE__->config( dbi => { label => 'dbi_label_name', dbname => 'sessions', id_field => 'id', data_field => 'a_session', time_field => 'lastmod', prepare_cache => 1, }, ); __PACKAGE__->startup( Base::DBI Store::Base64 ID::SHA1 Bind::Cookie );
The session data is preserved by using DBI.
'Egg::Model::DBI' should be able to be used for use.
And, Egg::Helper::Model::Session. 'Base::DBI' is added to startup of the component module that generates.
'Base::FileCache' in this systemIt is not possible to cooperate and delete it, please.
Moreover, it is necessary to load Store system module to treat the session data appropriately.
__PACKAGE__->startup( Base::DBI Store::Base64 ID::SHA1 Bind::Cookie );
If Egg::Plugin::EasyDBI is effective, it is late commit.
It sets in config of the session component module and it sets it to 'dbi' key with HASH.
Label name to use Egg::Model::DBI.
Default is 'dbi::main'.
Table name that preserves session data.
Default is 'sessions'.
Please make this table beforehand by the following compositions.
CREATE TABLE [dbname] ( id char(32) primary key, lastmod timestamp, a_session text );
Name of session ID column.
Default is 'id'.
Name of session data column.
Default is 'a_session'.
Name of updated day and hour column.
Default is 'lastmod'.
When this item is made effective, 'prepare_cached' method of DBI comes to be used by the restore method.
Default is undefined.
Because most of these methods is the one that Egg::Model::Session internally uses it, it is not necessary to usually consider it on the application side.
The label name of the model used is returned.
SQL statement used by the insert method is returned.
SQL statement used by the update method is returned.
SQL statement used by the delete method is returned.
SQL statement used by the clear method is returned.
The session data obtained by received SESSION_ID is returned.
When SESSION_ID is not obtained, it acquires it in 'session_id' method.
New session data is preserved.
SESSION_DATA is indispensable.
When SESSION_ID is not obtained, it acquires it in 'Session_id' method.
Existing session data is updated.
The session data is deleted.
SESSION_ID is indispensable.
$session->delete('abcdefghijkemn12345');
All the session data before TIME_VALUE is deleted.
# The update on deletes all the session data that not is. $session->clear_sessions( time - (24 * 60 * 60) );
Egg::Model::Session::Manager::TieHash Commit is done back.
However, if 'is_update' method is invalid, rollback is issued. In a word, if data was not substituted for the session, the data is annulled.
When Egg::Plugin::EasyDBI is loaded, nothing is done.
Egg::Release, Egg::Model::Session, Egg::Model::Session::Manager::Base, Egg::Model::Session::Manager::TieHash, Egg::Model, Egg::Model::DBI, Time::Piece::MySQL,
Masatoshi Mizuno <lushe@cpan.org>
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Egg::Plugin::SessionKit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Plugin::SessionKit
CPAN shell
perl -MCPAN -e shell install Egg::Plugin::SessionKit
For more information on module installation, please visit the detailed CPAN module installation guide.