File Coverage

blib/lib/Tie/Redis/Hash.pm
Criterion Covered Total %
statement 0 24 0.0
branch n/a
condition n/a
subroutine 0 10 0.0
pod n/a
total 0 34 0.0


line stmt bran cond sub pod time code
1             package Tie::Redis::Hash;
2             {
3             $Tie::Redis::Hash::VERSION = '0.26';
4             }
5             # ABSTRACT: Connect a Redis hash to a Perl hash
6              
7             sub TIEHASH {
8 0     0     my($class, %args) = @_;
9              
10 0           return bless {
11             redis => $args{redis},
12             key => $args{key}
13             };
14             }
15              
16             sub _cmd {
17 0     0     my($self, $cmd, @args) = @_;
18 0           return $self->{redis}->_cmd($cmd, $self->{key}, @args);
19             }
20              
21             sub FETCH {
22 0     0     my($self, $key) = @_;
23 0           $self->_cmd(hget => $key);
24             }
25              
26             sub STORE {
27 0     0     my($self, $key, $value) = @_;
28 0           $self->_cmd(hset => $key, $value);
29             }
30              
31             sub FIRSTKEY {
32 0     0     my($self) = @_;
33 0           $self->{keys} = $self->_cmd("hkeys");
34 0           $self->NEXTKEY;
35             }
36              
37             sub NEXTKEY {
38 0     0     my($self) = @_;
39 0           shift @{$self->{keys}};
  0            
40             }
41              
42             sub EXISTS {
43 0     0     my($self, $key) = @_;
44 0           $self->_cmd(hexists => $key);
45             }
46              
47             sub DELETE {
48 0     0     my($self, $key) = @_;
49 0           my $val = $self->_cmd(hget => $key);
50 0           $self->_cmd(hdel => $key);
51 0           $val;
52             }
53              
54             sub CLEAR {
55 0     0     my($self) = @_;
56             # technically should keep the hash around, this will do for now, rather
57             # than doing three commands...
58 0           $self->_cmd("del");
59             }
60              
61             sub SCALAR {
62 0     0     my($self) = @_;
63 0           $self->_cmd("hlen");
64             }
65              
66             1;
67              
68              
69              
70             __END__