Ref/Util/LRU/List.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 4 totaltotal 90.7% 39 / 43 CC 4 SCAR 5.5
CC
4
Cov
100%
hit
3.0
remove
2.0
BEGIN
1.0
CRAP 1.7
« Ref/Util/LRU/Array.pm ↑ Summary Ref/Random.pm »
1 package Cache::Ref::Util::LRU::List;
2 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 $Cache::Ref::Util::LRU::List::AUTHORITY = 'cpan:NUFFIN';
4 }
5 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 $Cache::Ref::Util::LRU::List::VERSION = '0.05'; # TRIAL
7 }
8 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 with (
13 'Cache::Ref::Util::LRU::API',
14 'Cache::Ref::Role::WithDoublyLinkedList' => {
15 name => "",
16 value_offset => 0,
17 next_offset => 1,
18 prev_offset => 2,
19  
20 head_method => "mru",
21 tail_method => "lru",
22 shift_method => "remove_mru",
23 pop_method => "remove_lru",
24 unshift_method => "insert",
25 },
26 );
27  
28 3038 ▶sub hit {
Subroutine hit: called CC=3 SCAR=11.0
Pod undocumented
29 3038 my ( $self, @l ) = @_;
30  
31 3038 ▶ return unless @l;
Branch: 1 branch
BranchTrueFalseTotal
unless @l 1783 1255 3038
32  
33 1255 $self->_splice(@l);
34 1255 $self->_link_sequence(@l);
35  
36 1255 my ( $head, $tail ) = @l[0, -1];
37  
38 1255 ▶ if ( my $old_head = $self->_head ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $old_head = $self->_head) { } 1253 2 1255
39 # prepend @l to the head of the list
40 1253 $self->_set_prev($old_head, $tail);
41 1253 $self->_set_next($tail, $old_head);
42 } else {
43 # just set @l as the new list
44 2 $self->_tail($tail);
45 }
46  
47 1255 $self->_head($head);
48  
49 1255 return;
50 }
51  
52 4 ▶sub remove {
Subroutine remove: called CC=2 SCAR=6.9
Pod undocumented
53 4 my ( $self, @l ) = @_;
54  
55 4 $self->_splice(@l);
56 4 @$_ = () for @l;
57 }
58  
59 6 ▶sub clear { shift->_clear }
Subroutine clear: called CC=1 SCAR=0.0
Pod undocumented
60  
61 3 ▶sub DEMOLISH { shift->clear }
Subroutine DEMOLISH: called CC=1 SCAR=0.0
Pod undocumented
62  
63 2 __PACKAGE__->meta->make_immutable;
64  
65 2 __PACKAGE__;
66  
67 # ex: set sw=4 et:
68  
69  
70 __END__
« Ref/Util/LRU/Array.pm ↑ Summary Ref/Random.pm »