NAME
Catalyst::Plugin::Session::DynamicExpiry - per-session custom expiry times
SYNOPSIS
# put Session::DynamicExpiry in your use Catalyst line
# note that for this plugin to work it must appear before the Session
# plugin, since it overrides some of that plugin's methods.
use Catalyst qw/ ...
Session::DynamicExpiry
Session
/;
if ($c->req->param('remember') {
$c->session_time_to_live( 604800 ) # expire in one week.
}
DESCRIPTION
This module allows you to expire session cookies indvidually per session.
If the session_time_to_live
field is defined it will set expiry to that many seconds into the future. Note that the session cookie is set on every request, so a expiry of one week will stay as long as the user visits the site at least once a week.
Once ttl has been set for a session the ttl will be stored in the __time_to_live
key within the session data itself, and reused for subsequent request, so you only need to set this once per session (not once per request).
This is unlike the ttl option in the config in that it allows different sessions to have different times, to implement features like "remember me" checkboxes.
METHODS
session_time_to_live $ttl
To set the TTL for this session use this method.
OVERRIDDEN METHODS
calculate_initial_session_expires
calculate_extended_session_expires
Overridden to implement dynamic expiry functionality.
CAVEATS
When it just doesn't work, it's usually because you put it after Catalyst::Plugin::Session in the plugin list. It must go before it so that it can override Catalyst::Plugin::Session's methods.
SEE ALSO
Catalyst::Plugin::Session - The new session framework.
Catalyst - The Catalyst framework itself.
AUTHOR
Marcus Ramberg, mramberg@cpan.org
Yuval Kogman
LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.