Store/NoSQL/Redis.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
insert
2.0
materialize
2.0
CRAP 2.0
1 package Apache::Session::Store::NoSQL::Redis;
2  
3 use strict;
4 use Redis;
5  
6 our $VERSION = '0.1';
7  
8 sub new {
9 my ( $class, $session ) = @_;
10 my $self;
11  
12 $self->{cache} = Redis->new( %{ $session->{args} } );
13  
14 bless $self, $class;
15 }
16  
17 sub insert {
18 my ( $self, $session ) = @_;
19 $self->{cache}
20 ->set( $session->{data}->{_session_id}, $session->{serialized} );
21 }
22  
23 *update = *insert;
24  
25 sub materialize {
26 my ( $self, $session ) = @_;
27 $session->{serialized} =
28 $self->{cache}->get( $session->{data}->{_session_id} )
29 or die 'Object does not exist in data store.';
30 }
31  
32 sub remove {
33 my ( $self, $session ) = @_;
34 $self->{cache}->del( $session->{data}->{_session_id} );
35 }
36  
37 1;
38 __END__