MojoX::Session::Store::Redis - RedisDB Store for MojoX::Session
Version 0.06
my $session = MojoX::Session->new( tx => $tx, store => MojoX::Session::Store::Redis->new({ server => '127.0.0.1:6379', redis_prefix => 'mojo-session', redis_dbid => 0, }), transport => MojoX::Session::Transport::Cookie->new, ); # see doc for MojoX::Session
And later when you need to use it in Mojolicious Controller
my $session = $self->stash('mojox-session'); $session->load; $session->create unless $session->sid; #set $session->data( id => 5, name => 'hoge', ); #get my $name = $session->data('name');
MojoX::Session::Store::Redis is a store for MojoX::Session that stores a session in a Redis database.
MojoX::Session::Store::Redis implements the following attributes.
redis
Get and set Redis object.
$store->redis( Redis->new($param) ); my $redis = $store->redis;
redis_prefix
Get and set the Key prefix of the stored session in Redis. Default is 'mojo-session'.
$store->redis_prefix('mojo-session'); my $prefix = $store->redis_prefix;
redis_dbid
Get and set the DB ID Number to use in Redis DB. Default is 0.
$store->redis_dbid(0); my $dbid = $store->redis_dbid;
MojoX::Session::Store::Redis inherits all methods from MojoX::Session::Store, and few more.
new
new uses the redis_prefix and redis_dbid parameters for the Key name prefix and the DB ID Number respectively. All other parameters are passed to Redis-new()>.
Redis-
create
Insert session to Redis.
update
Update session in Redis.
load
Load session from Redis.
delete
Delete session from Redis.
BlueT - Matthew Lien - 練喆明, <BlueT at BlueT.org>
<BlueT at BlueT.org>
Please report any bugs or feature requests to bug-mojox-session-store-redis at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MojoX-Session-Store-Redis. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-mojox-session-store-redis at rt.cpan.org
Tatsuya Fukata, https://github.com/fukata
Main:
bzr repository etc at L<https://launchpad.net/p5-mojox-session-store-redis>.
A copy of the codes:
git repository etc at L<https://github.com/BlueT/p5-MojoX-Session-Store-Redis>.
You can find documentation for this module with the perldoc command.
perldoc MojoX::Session::Store::Redis
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MojoX-Session-Store-Redis
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/MojoX-Session-Store-Redis
CPAN Ratings
http://cpanratings.perl.org/d/MojoX-Session-Store-Redis
Search CPAN
http://search.cpan.org/dist/MojoX-Session-Store-Redis/
Copyright 2011 BlueT - Matthew Lien - 練喆明.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MojoX::Session::Store::Redis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MojoX::Session::Store::Redis
CPAN shell
perl -MCPAN -e shell install MojoX::Session::Store::Redis
For more information on module installation, please visit the detailed CPAN module installation guide.