Ref/Role/Index.pm

filter: Statementstmt 100% 28 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 100% 39 / 39 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Ref.pm ↑ Summary Ref/Util/LRU/API.pm »
1 package Cache::Ref::Role::Index;
2 6 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 $Cache::Ref::Role::Index::AUTHORITY = 'cpan:NUFFIN';
4 }
5 6 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 $Cache::Ref::Role::Index::VERSION = '0.05'; # TRIAL
7 }
8 6 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # the index handles the by key lookup for all expiry methods
13 # the actual entries are set up by the manager though
14 # an entry in the index does not mean the key is live, it only means that it is
15 # known
16 has _index => (
17 isa => "HashRef",
18 18 ▶ default => sub { return {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
19 6 is => "ro",
20 );
21  
22 20 ▶sub _index_clear {
Subroutine _index_clear: called CC=1 SCAR=0.0
23 20 my $self = shift;
24 20 %{ $self->_index } = ();
25 }
26  
27 1337 ▶sub _index_keys {
Subroutine _index_keys: called CC=1 SCAR=0.0
28 1337 my $self = shift;
29 1337 keys %{ $self->_index };
30 }
31  
32 166333 ▶sub _index_get {
Subroutine _index_get: called CC=1 SCAR=0.0
33 166333 my ( $self, @keys ) = @_;
34 166333 @{ $self->_index }{@keys};
35 }
36  
37 55517 ▶sub _index_set {
Subroutine _index_set: called CC=1 SCAR=0.0
38 55517 my ( $self, $key, $value ) = @_;
39 55517 $self->_index->{$key} = $value;
40 }
41  
42 748038 ▶sub _index_size {
Subroutine _index_size: called CC=1 SCAR=0.0
43 748038 my $self = shift;
44 748038 scalar keys %{ $self->_index };
45 }
46  
47 54456 ▶sub _index_delete {
Subroutine _index_delete: called CC=1 SCAR=0.0
48 54456 my ( $self, @keys ) = @_;
49 54456 delete @{ $self->_index }{@keys};
50 }
51  
52 # ex: set sw=4 et:
53  
54 6 __PACKAGE__;
55  
56  
57 __END__
« Ref.pm ↑ Summary Ref/Util/LRU/API.pm »