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
|
|
194555
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
7
|
2
|
|
|
2
|
|
1063
|
use Tie::Redis::Candy::Hash; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
58
|
|
8
|
2
|
|
|
2
|
|
1177
|
use Tie::Redis::Candy::Array; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
63
|
|
9
|
2
|
|
|
2
|
|
13
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
389
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.000'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw(redis_hash redis_array); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub redis_hash { |
16
|
2
|
|
|
2
|
1
|
1247
|
my ( $redis, $prefix, %init ) = @_; |
17
|
2
|
|
|
|
|
21
|
tie( my %hash, 'Tie::Redis::Candy::Hash', $redis, $prefix ); |
18
|
2
|
|
|
|
|
25
|
$hash{$_} = delete $init{$_} for keys %init; |
19
|
2
|
|
|
|
|
1132
|
bless( \%hash, 'Tie::Redis::Candy::Hash' ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub redis_array { |
23
|
2
|
|
|
2
|
1
|
1284
|
my ( $redis, $listname, @init ) = @_; |
24
|
2
|
|
|
|
|
17
|
tie( my @array, 'Tie::Redis::Candy::Array', $redis, $listname ); |
25
|
2
|
|
|
|
|
24
|
while ( my $item = shift @init ) { |
26
|
4
|
|
|
|
|
485
|
push @array => $item; |
27
|
|
|
|
|
|
|
} |
28
|
2
|
|
|
|
|
439
|
bless( \@array, 'Tie::Redis::Candy::Array' ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |