| 1 | |||||||||||||||||||||||||||||
| 2 | package MooseX::WithCache::Backend::Cache::FileCache; | ||||||||||||||||||||||||||||
| 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 'Cache::FileCache'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub _build_cache_type { | ||||||||||||||||||||||||||
|
Subroutine
_build_cache_type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | return 'Cache::FileCache'; | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | around _build_methods => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 15 | 1 | my ($next, $self) = @_; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | my $methods = $next->($self); | |||||||||||||||||||||||||||
| 18 | 4 | ▶ | $methods->{cache_del} = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.0
| |||||||||||||||||||||||||||||
| 19 | 4 | my ($self, $key) = @_; | |||||||||||||||||||||||||||
| 20 | 4 | my $cache = $self->__get_cache(); | |||||||||||||||||||||||||||
| 21 | 4 | ▶ | if ($self->cache_disabled || ! $cache) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->cache_disabled or not $cache
MC/DC0%0/2
$self->cache_disabled or not $cache
$self->cache_disabled
not $cache
Truth table33%1/3
A or not(B)
A= $self->cache_disabledB= not $cache
| |||||||||||||||||||||||||||||
| 22 | 0 | if (MooseX::WithCache::DEBUG()) { | |||||||||||||||||||||||||||
| 23 | $self->cache_debug("cache_set: Cache disabled"); | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 0 | return (); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 4 | my $keygen = $self->cache_key_generator; | |||||||||||||||||||||||||||
| 29 | 4 | ▶ | my $cache_key = $keygen ? $keygen->generate($key) : $key; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 4 | if (MooseX::WithCache::DEBUG()) { | |||||||||||||||||||||||||||
| 31 | $self->cache_debug( | ||||||||||||||||||||||||||||
| 32 | "cache_del: key =", | ||||||||||||||||||||||||||||
| 33 | ($cache_key || '(null)'), | ||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 4 | return $cache->remove($cache_key); | |||||||||||||||||||||||||||
| 37 | 1 | }; | |||||||||||||||||||||||||||
| 38 | 1 | return $methods; | |||||||||||||||||||||||||||
| 39 | 1 | }; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | 1 | ▶ | no Moose::Util::TypeConstraints; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 1 | 1; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | __END__ | ||||||||||||||||||||||||||||