Plack-Session-Store-RedisFast

Redis session store.


Keywords
plack, redis, session-store
License
MIT

Documentation

Build Status codecov

NAME

Plack::Session::Store::RedisFast - Redis session store.

DESCRIPTION

Default implementation of Redis handle is Redis::Fast; otherwise Redis.

May be overriden through "redis" param.

Default implementation of serializer handle is JSON::XS; otherwise Mojo::JSON or JSON.

May be overriden through "inflate" and "deflate" param.

SYNOPSIS

use Plack::Builder;
use Plack::Session::Store::RedisFast;

my $app = sub {
    return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
};

builder {
    enable 'Session',
        store => Plack::Session::Store::RedisFast->new;
    $app;
};

DESCRIPTION

This will persist session data using Redis::Fast or Redis.

This is a subclass of Plack::Session::Store and implements its full interface.

METHODS

new

Plack::Session::Store::RedisFast->new( %param );

Parameters:

  • redis

    A simple accessor for the Redis handle.

  • inflate

    A simple serializer, requires "deflate" param.

  • deflate

    A simple deserializer, requires "inflate" param.

  • encoder

    A simple encoder (encode/decode implementation), class or instance. JSON/utf8 by default.

  • prefix

    A prefix for Redis session ids. 'Plack::Session::Store::RedisFast:' by default.

  • expires

    An expires for Redis sessions. "ONE_MONTH" in Time::Seconds by default.

each_session

$store->each_session(sub {
    my ( $redis_instance, $redis_prefix, $session_id, $session ) = @_;
});

Enumerates all stored sessions using SCAN, see https://redis.io/commands/scan for limitations.

BUGS

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please fill in GitHub issues.

AUTHOR

Akzhan Abdulin akzhan.abdulin@gmail.com

COPYRIGHT

Copyright 2017- Akzhan Abdulin

LICENSE

MIT License