CGI::Session::Driver::redis - CGI::Session driver for redis
use strict; use warnings; use Redis; my $redis = Redis->new(); my $session = CGI::Session->new( "driver:redis", $sid, { Redis => $redis, Expire => 60*60*24 } );
This backend stores session data in a persistent redis server, with the ability to specify an expiry time in seconds.
The following options may be passed to the constructor:
Expiry
Which is the time to expire the sessions, in seconds, in inactivity. Supplying a value of "0" equates to never expiring sessions.
Prefix
A string value to prefix to the session ID prior to redis storage. The default is "session".
Redis
A Redis object which will be used to store the session data within.
Steve Kemp <steve@steve.org.uk>
Copyright (C) 2010 Steve Kemp <steve@steve.org.uk>.
This library is free software. You can modify and or distribute it under the same terms as Perl itself.
Initialise our driver, ensuring we received a 'Redis' attribute.
Generate a key, by joining a prefix and the session identifier, then store the session underneath that key.
Generate a key, by joining a prefix and the session identifier, then return the session information stored under that key.
Generate a key, by joining a prefix and the session identifier, then remove that key from the Redis store.
CGI::Session - CGI::Session manual
CGI::Session::Tutorial - extended CGI::Session manual
CGI::Session::CookBook - practical solutions for real life problems
Redis - Redis interface library.
To install CGI::Session::Driver::redis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Session::Driver::redis
CPAN shell
perl -MCPAN -e shell install CGI::Session::Driver::redis
For more information on module installation, please visit the detailed CPAN module installation guide.