The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CGI::Session::Driver::redis - CGI::Session driver for redis

SYNOPSIS

    use strict;
    use warnings;
    use Redis;

    my $redis = Redis->new();

    my $session = CGI::Session->new( "driver:redis", $sid, { Redis => $redis,
                                                             Expire => 60*60*24 } );

DESCRIPTION

This backend stores session data in a persistent redis server, with the ability to specify an expiry time in seconds.

REQUIREMENTS

CGI::Session
Redis

DRIVER ARGUMENTS

The following options may be passed to the constructor:

Expiry

Which is the time to expire the sessions, in seconds, on 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.

METHODS

Now follows documentation on the available methods.

init

Initialise our driver, ensuring we received a 'Redis' attribute.

store

Generate a key, by joining a prefix and the session identifier, then store the session underneath that key.

retrieve

Generate a key, by joining a prefix and the session identifier, then return the session information stored under that key.

retrieve

Generate a key, by joining a prefix and the session identifier, then remove that key from the Redis store.

traverse

Invoke the specified code reference on each active session.

This is required to allow this driver to be used with the "find" in CGI::Session method.

SEE ALSO

AUTHOR

Steve Kemp <steve@steve.org.uk>

COPYRIGHT AND LICENSE

Copyright (C) 2010-2016 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.