line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Redis::Candy; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Tie Redis to HashRef or ArrayRef |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
47694
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
97
|
|
6
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
70
|
|
7
|
2
|
|
|
2
|
|
907
|
use Tie::Redis::Candy::Hash; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
8
|
2
|
|
|
2
|
|
947
|
use Tie::Redis::Candy::Array; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
89
|
|
9
|
2
|
|
|
2
|
|
15
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
410
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw(redis_hash redis_array); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub redis_hash { |
16
|
0
|
|
|
0
|
1
|
|
my ( $redis, $prefix, %init ) = @_; |
17
|
0
|
|
|
|
|
|
tie( my %hash, 'Tie::Redis::Candy::Hash', $redis, $prefix ); |
18
|
0
|
|
|
|
|
|
$hash{$_} = delete $init{$_} for keys %init; |
19
|
0
|
|
|
|
|
|
bless( \%hash, 'Tie::Redis::Candy::Hash' ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub redis_array { |
23
|
0
|
|
|
0
|
1
|
|
my ( $redis, $listname, @init ) = @_; |
24
|
0
|
|
|
|
|
|
tie( my @array, 'Tie::Redis::Candy::Array', $redis, $listname ); |
25
|
0
|
|
|
|
|
|
while ( my $item = shift @init ) { |
26
|
0
|
|
|
|
|
|
push @array => $item; |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
bless( \@array, 'Tie::Redis::Candy::Array' ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |