Store/NoSQL/Cassandra.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
insert
2.0
materialize
2.0
CRAP 2.0
1  
2 package Apache::Session::Store::NoSQL::Cassandra;
3  
4 use strict;
5 use Net::Cassandra;
6  
7 use vars qw($VERSION);
8 $VERSION = '0.1';
9  
10 sub new {
11 my ( $class, $session ) = @_;
12 my $self;
13  
14 $self->{cache} = Net::Cassandra->new( %{$session} )->client;
15  
16 bless $self, $class;
17 }
18  
19 sub insert {
20 my ( $self, $session ) = @_;
21 $self->{cache}->insert(
22 'Keyspace1',
23 $session->{data}->{_session_id},
24 Net::Cassandra::Backend::ColumnPath->new(
25 { column_family => 'Standard1', column => 'name' }
26 ),
27 $session->{serialized},
28 time,
29 Net::Cassandra::Backend::ConsistencyLevel::QUORUM
30 );
31 }
32  
33 *update = *insert;
34  
35 sub materialize {
36 my ( $self, $session ) = @_;
37 $self->{cache}->get(
38 'Keyspace1',
39 $session->{data}->{_session_id},
40 Net::Cassandra::Backend::ColumnPath->new(
41 { column_family => 'Standard1', column => 'name' }
42 ),
43 Net::Cassandra::Backend::ConsistencyLevel::QUORUM
44 ) or die 'Object does not exist in data store.';
45 }
46  
47 sub remove {
48 my ( $self, $session ) = @_;
49 $self->{cache}->remove(
50 'Keyspace1',
51 $session->{data}->{_session_id},
52 Net::Cassandra::Backend::ColumnPath->new(
53 { column_family => 'Standard1', column => 'name' }
54 ),
55 time,
56 Net::Cassandra::Backend::ConsistencyLevel::QUORUM
57 );
58 }
59  
60 1;
61  
62 __END__