WithCache/Backend/CHI.pm

filter: Statementstmt 96.6% 29 / 30 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 95.1% 39 / 41 CC 3 SCAR 5.2
CC
3
Cov
94%
cache_del
3.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.7
« WithCache/Backend/Cache/Memcached.pm ↑ Summary WithCache/KeyGenerator.pm »
1  
2 package MooseX::WithCache::Backend::CHI;
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 extends 'MooseX::WithCache::Backend';
7  
8 1 class_type 'CHI::Driver';
9  
10 1 ▶sub _build_cache_type {
Subroutine _build_cache_type: called CC=1 SCAR=0.0
11 1 return 'CHI::Driver';
12 }
13  
14 1 ▶around _build_methods => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 1 my ($next, $self) = @_;
16 1 my $methods = $next->($self);
17 4 ▶ $methods->{cache_del} = sub {
Subroutine cache_del: called CC=3 SCAR=11.1
18 4 my ($self, $key) = @_;
19 4 my $cache = $self->__get_cache();
20 4 ▶ if (! $cache) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cache) 0 4 4
21 0 return ();
22 }
23  
24 4 my $keygen = $self->cache_key_generator;
25 4 ▶ my $cache_key = $keygen ? $keygen->generate($key) : $key;
Branch: 1 branch
BranchTrueFalseTotal
$keygen ? : 2 2 4
26 4 if (MooseX::WithCache::DEBUG()) {
27 $self->cache_debug(
28 "cache_del: key =",
29 ($cache_key || '(null)'),
30 );
31 }
32 4 return $cache->remove($cache_key);
33 1 };
34 1 return $methods;
35 1 };
36  
37 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 1 __PACKAGE__->meta->make_immutable;
41  
42 1 1;
43  
44 __END__
« WithCache/Backend/Cache/Memcached.pm ↑ Summary WithCache/KeyGenerator.pm »