File Coverage

blib/lib/Amon2/Plugin/Redis.pm
Criterion Covered Total %
statement 15 23 65.2
branch 0 4 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 20 35 57.1


line stmt bran cond sub pod time code
1             package Amon2::Plugin::Redis;
2 1     1   755 use 5.008001;
  1         3  
  1         40  
3 1     1   6 use strict;
  1         2  
  1         30  
4 1     1   5 use warnings;
  1         12  
  1         29  
5 1     1   1141 use Redis;
  1         80355  
  1         70  
6              
7             our $VERSION = "0.04";
8              
9             sub init {
10 0     0 0   my ($class, $context) = @_;
11 1     1   10 no strict 'refs';
  1         2  
  1         145  
12 0           *{"$context\::redis"} = \&_redis;
  0            
13             }
14              
15             sub _redis {
16 0     0     my ($self,) = @_;
17              
18 0 0         if (!exists $self->{redis}) {
19 0 0         $self->{redis} = Redis->new(%{ $self->config->{Redis} || +{} });
  0            
20             }
21 0           $self->{redis};
22             }
23              
24              
25             1;
26             __END__