Skip to content

Commit 225e1df

Browse files
committed
0.09
changed: README -> README.pod fixed: Makefile.PL and use utf8 added: META.yml META.json
1 parent 3852d53 commit 225e1df

File tree

6 files changed

+205
-74
lines changed

6 files changed

+205
-74
lines changed

Changes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Revision history for MojoX-Session-Store-Redis
22

3+
0.09 Sun Feb 12 23:27:55 CST 2017
4+
changed: README -> README.pod
5+
fixed: Makefile.PL and use utf8
6+
added: META.yml META.json
7+
38
0.08 Sun Feb 12 22:22:26 CST 2017
49
removed: redis->new param checks
510

MANIFEST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changes
22
MANIFEST
33
Makefile.PL
4-
README
4+
README.pod
55
lib/MojoX/Session/Store/Redis.pm
66
t/00-load.t
77
t/boilerplate.t

Makefile.PL

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use utf8;
12
use strict;
23
use warnings;
34
use ExtUtils::MakeMaker;
45

56
WriteMakefile(
6-
NAME => 'MojoX-Session-Store-Redis',
7+
NAME => 'MojoX::Session::Store::Redis',
78
AUTHOR => q{BlueT - Matthew Lien - 練喆明 <[email protected]>},
89
VERSION_FROM => 'lib/MojoX/Session/Store/Redis.pm',
910
ABSTRACT_FROM => 'lib/MojoX/Session/Store/Redis.pm',
@@ -12,12 +13,12 @@ WriteMakefile(
1213
: ()),
1314
PL_FILES => {},
1415
PREREQ_PM => {
15-
'Test::More' => 0,
16-
'Redis' => 0,
17-
'namespace::clean' => 0,
18-
'MojoX::Session::Store' => 0,
19-
'JSON' => 0,
16+
'Test::More' => 0,
17+
'Redis' => 0,
18+
'namespace::clean' => 0,
19+
'MojoX::Session::Store' => 0,
20+
'JSON' => 0,
2021
},
2122
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
22-
clean => { FILES => 'AnyEvent-CallbackStack-*' },
23+
clean => { FILES => 'MojoX-Session-Store-Redis-*' },
2324
);

README

Lines changed: 0 additions & 64 deletions
This file was deleted.

README.pod

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
=encoding utf8
2+
3+
=head1 NAME
4+
5+
MojoX::Session::Store::Redis - RedisDB Store for MojoX::Session
6+
7+
=head1 VERSION
8+
9+
Version 0.09
10+
11+
12+
=cut
13+
14+
=head1 SYNOPSIS
15+
16+
my $session = MojoX::Session->new(
17+
tx => $tx,
18+
store => MojoX::Session::Store::Redis->new({
19+
server => '127.0.0.1:6379',
20+
redis_prefix => 'mojo-session',
21+
redis_dbid => 0,
22+
}),
23+
transport => MojoX::Session::Transport::Cookie->new,
24+
);
25+
26+
# see doc for MojoX::Session
27+
# see doc for Redis
28+
29+
And later when you need to use it in Mojolicious Controller
30+
31+
my $session = $self->stash('mojox-session');
32+
$session->load;
33+
$session->create unless $session->sid;
34+
35+
#set
36+
$session->data(
37+
id => 5,
38+
name => 'hoge',
39+
);
40+
41+
#get
42+
my $name = $session->data('name');
43+
44+
45+
=head1 DESCRIPTION
46+
47+
L<MojoX::Session::Store::Redis> is a store for L<MojoX::Session> that stores a
48+
session in a L<Redis> database.
49+
50+
51+
=head1 ATTRIBUTES
52+
53+
L<MojoX::Session::Store::Redis> implements the following attributes.
54+
55+
=head2 C<redis>
56+
57+
Get and set Redis object. See doc for L<Redis> param.
58+
59+
$store->redis( Redis->new($param) );
60+
my $redis = $store->redis;
61+
62+
=head2 C<redis_prefix>
63+
64+
Get and set the Key prefix of the stored session in Redis.
65+
Default is 'mojo-session'.
66+
67+
$store->redis_prefix('mojo-session');
68+
my $prefix = $store->redis_prefix;
69+
70+
=head2 C<redis_dbid>
71+
72+
Get and set the DB ID Number to use in Redis DB.
73+
Default is 0.
74+
75+
$store->redis_dbid(0);
76+
my $dbid = $store->redis_dbid;
77+
78+
=head2 C<auto_purge>
79+
80+
Enable/disable auto purge.
81+
When enable, session object/data stored in RedisDB will be automatically purged after TTL.
82+
This is done by setting expire time for objects just right after creating them.
83+
Changing this can only affect on objects created/updated after the change.
84+
Default is 1 (enable).
85+
86+
$store->auto_purge(1);
87+
my $is_auto_purge_enabled = $store->auto_purge;
88+
89+
=head1 METHODS
90+
91+
L<MojoX::Session::Store::Redis> inherits all methods from
92+
L<MojoX::Session::Store>, and few more.
93+
94+
=head2 C<new>
95+
96+
C<new> uses the redis_prefix and redis_dbid parameters for the Key name prefix
97+
and the DB ID Number respectively. All other parameters are passed to C<Redis->new()>.
98+
99+
=head2 C<create>
100+
101+
Insert session to Redis.
102+
103+
=head2 C<update>
104+
105+
Update session in Redis.
106+
107+
=head2 C<load>
108+
109+
Load session from Redis.
110+
111+
=head2 C<delete>
112+
113+
Delete session from Redis.
114+
115+
116+
=head1 AUTHOR
117+
118+
BlueT - Matthew Lien - 練喆明, C<< <BlueT at BlueT.org> >>
119+
120+
121+
=head1 BUGS
122+
123+
Please report any bugs or feature requests to C<bug-mojox-session-store-redis at rt.cpan.org>, or through
124+
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MojoX-Session-Store-Redis>. I will be notified, and then you'll
125+
automatically be notified of progress on your bug as I make changes.
126+
127+
128+
=head1 CREDITS
129+
130+
Tatsuya Fukata, L<https://github.com/fukata>
131+
132+
=head1 CONTRIBUTE
133+
134+
Main:
135+
136+
bzr repository etc at L<https://launchpad.net/p5-mojox-session-store-redis>.
137+
138+
A copy of the codes:
139+
140+
git repository etc at L<https://github.com/BlueT/p5-MojoX-Session-Store-Redis>.
141+
142+
143+
=head1 SUPPORT
144+
145+
You can find documentation for this module with the perldoc command.
146+
147+
perldoc MojoX::Session::Store::Redis
148+
149+
150+
You can also look for information at:
151+
152+
=over 4
153+
154+
=item * RT: CPAN's request tracker
155+
156+
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MojoX-Session-Store-Redis>
157+
158+
=item * AnnoCPAN: Annotated CPAN documentation
159+
160+
L<http://annocpan.org/dist/MojoX-Session-Store-Redis>
161+
162+
=item * CPAN Ratings
163+
164+
L<http://cpanratings.perl.org/d/MojoX-Session-Store-Redis>
165+
166+
=item * Search CPAN
167+
168+
L<http://search.cpan.org/dist/MojoX-Session-Store-Redis/>
169+
170+
=back
171+
172+
173+
=head1 ACKNOWLEDGEMENTS
174+
175+
176+
=head1 LICENSE AND COPYRIGHT
177+
178+
Copyright 2011 BlueT - Matthew Lien - 練喆明.
179+
180+
This program is free software; you can redistribute it and/or modify it
181+
under the terms of either: the GNU General Public License as published
182+
by the Free Software Foundation; or the Artistic License.
183+
184+
See http://dev.perl.org/licenses/ for more information.
185+
186+
187+
188+
=cut
189+

lib/MojoX/Session/Store/Redis.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ MojoX::Session::Store::Redis - RedisDB Store for MojoX::Session
2424
2525
=head1 VERSION
2626
27-
Version 0.08
27+
Version 0.09
2828
2929
=cut
3030

31-
our $VERSION = '0.08';
31+
our $VERSION = '0.09';
3232

3333

3434
sub new {

0 commit comments

Comments
 (0)