line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Model::Redis; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
33276
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
5
|
2
|
|
|
2
|
|
10
|
use base 'Catalyst::Model'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
1392
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
1469
|
use MRO::Compat; |
|
2
|
|
|
|
|
5572
|
|
|
2
|
|
|
|
|
50
|
|
11
|
2
|
|
|
2
|
|
12
|
use mro 'c3'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
12
|
2
|
|
|
2
|
|
2094
|
use RedisDB; |
|
2
|
|
|
|
|
149042
|
|
|
2
|
|
|
|
|
316
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Catalyst::Model::Redis - Redis Model Class |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
0.01 |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# use helper to add model |
25
|
|
|
|
|
|
|
create model Redis Redis server port password |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# lib/MyApp/Model/Redis.pm |
28
|
|
|
|
|
|
|
package MyApp::Model::Redis; |
29
|
|
|
|
|
|
|
use parent "Catalyst::Model::Redis"; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->config( |
32
|
|
|
|
|
|
|
host => 'localhost', |
33
|
|
|
|
|
|
|
port => 6379, |
34
|
|
|
|
|
|
|
database => 3, |
35
|
|
|
|
|
|
|
password => 'secret', |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# in controller |
41
|
|
|
|
|
|
|
my $redis = $c->model('Redis')->redis; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This module implements Redis model class for Catalyst. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 $self->new |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Initializes L<RedisDB> object |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new { |
58
|
0
|
|
|
0
|
1
|
|
my $self = shift->next::method(@_); |
59
|
0
|
|
|
|
|
|
my $c = shift; |
60
|
0
|
|
|
|
|
|
$self->{redis} = RedisDB->new( |
61
|
0
|
|
|
|
|
|
map { $_ => $self->{$_} } qw(host port path database password lazy timeout utf8), |
62
|
|
|
|
|
|
|
); |
63
|
0
|
|
|
|
|
|
return $self; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 $self->redis |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns the L<RedisDB> object |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub redis { |
73
|
0
|
|
|
0
|
1
|
|
shift->{redis}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L<Catalyst>, L<RedisDB> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 BUGS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Please report any bugs or feature requests via GitHub bug tracker at |
87
|
|
|
|
|
|
|
L<http://github.com/trinitum/perl-Catalyst-Model-Redis/issues>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Pavel Shaydo C<< <zwon at cpan.org> >> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Copyright (C) 2012 Pavel Shaydo |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
98
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
99
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |