Plack::Session::Store::Transparent - Session store container which provides transparent access
use Plack::Builder; use Plack::Middleware::Session; use Plack::Session::Store::Transparent; use Plack::Session::Store::DBI; use Plack::Session::Store::Cache; use CHI; my $app = sub { return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ]; }; builder { enable 'Session', store => Plack::Session::Store::Transparent->new( origin => Plack::Session::Store::DBI->new( get_dbh => sub { DBI->connect(@connect_args) } ), cache => Plack::Session::Store::Cache->new( cache => CHI->new(driver => 'FastMmap') ) ); $app; };
This will manipulate multiple session stores transparently. This is a subclass of Plack::Session::Store and implements its full interface.
The constructor expects the origin argument to be a instance of Plack::Session::Store instance, and cache argument to be a instance of it or an arrayref which contains it, otherwise it will throw an exception. If the cache arguments is an arrayref, the elements of it will be accessed from the first.
Fetches session data from caches to origin, and stores the result in outside layers.
Stores session data in all layers (from caches to origin). If one of the layer throw an exception, this method will try to keep consistency between layers, i.e. remove this session from ouside layers.
Removes session data from all layers (from caches to origin).
A simple accessor for the layers.
Copyright (C) Ichito Nagata.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Ichito Nagata <i.nagata110@gmail.com>
To install Plack::Session::Store::Transparent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Session::Store::Transparent
CPAN shell
perl -MCPAN -e shell install Plack::Session::Store::Transparent
For more information on module installation, please visit the detailed CPAN module installation guide.