Plack::Session::Store::RedisFast - Redis session store.
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.
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;
};
This will persist session data using Redis::Fast or Redis.
This is a subclass of Plack::Session::Store and implements its full interface.
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.
$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.
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please fill in GitHub issues.
Akzhan Abdulin [email protected]
Copyright 2017- Akzhan Abdulin
MIT License