Skip to content

Commit

Permalink
improved session documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 11, 2011
1 parent 7511dd5 commit 269f6c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.0 2011-10-11 00:00:00
2.0 2011-10-12 00:00:00
- Code name "Leaf Fluttering In Wind", this is a major release.
- Increased Perl version requirement to 5.10.1.
- Renamed Mojo::IOLoop::EventEmitter to Mojo::EventEmitter.
Expand Down
10 changes: 8 additions & 2 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -354,8 +354,14 @@ secure and can be changed at any time to invalidate all existing sessions.
$self->session(user => 'sri');
my $user = $self->session('user');

By default all sessions expire after one hour, and the whole session can be
deleted by setting an expiration date in the past.
By default all sessions expire after one hour, for more control you can also
use the C<expires> session value to set the expiration date to a specific
time in epoch seconds.

$self->session(expires => time + 3600);

And the whole session can be deleted by setting an expiration date in the
past.

$self->session(expires => 1);

Expand Down
8 changes: 8 additions & 0 deletions lib/Mojolicious/Sessions.pm
Expand Up @@ -132,6 +132,14 @@ Path for session cookie, defaults to C</>.
Time for the session to expire in seconds from now, defaults to C<3600>.
The expiration timeout gets refreshed for every request.
For more control you can also use the C<expires> session value to set the
expiration date to a specific time in epoch seconds.
# Expire a week from now
$c->session(expires => time + 604800);
# Expire a long long time ago
$c->session(expires => 1);
=head2 C<secure>
Expand Down

0 comments on commit 269f6c5

Please sign in to comment.