blib/lib/DTL/Fast/Cache/Memcached.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 31 SCAR 17.9
CC
2
Cov
0%
new
6.0
read_data
2.0
write_data
2.0
CRAP 6.0
1 package DTL::Fast::Cache::Memcached;
2 use strict; use warnings FATAL => 'all';
3 use parent 'DTL::Fast::Cache::Runtime';
4  
5 our %SUPPORTS = qw(
6 Cache::Memcached 1
7 Cache::Memcached::Fast 1
8 );
9  
10 #@Override
11 sub new
12 {
13 my( $proto, $memcached ) = @_;
14
15 if( not exists $SUPPORTS{ref $memcached} )
16 {
17 die sprintf(
18 "You may construct %s object using one of the following modules:\n\t%s\n"
19 , $proto // 'undef'
20 , join( "\n\t", keys %SUPPORTS )
21 );
22 }
23
24 return $proto->SUPER::new( 'mc' => $memcached );
25
26 }
27  
28 #@Override
29 sub read_data
30 {
31 my( $self, $key ) = @_;
32 return $self->{'mc'}->get($key);
33 }
34  
35 #@Override
36 sub write_data{
37 my( $self, $key, $data ) = @_;
38  
39 return $self->{'mc'}->set($key, $data);
40 }
41  
42 1;