line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Driver::Metacache; |
2
|
|
|
|
|
|
|
$CHI::Driver::Metacache::VERSION = '0.61'; |
3
|
20
|
|
|
20
|
|
147
|
use CHI::Constants qw(CHI_Meta_Namespace); |
|
20
|
|
|
|
|
41
|
|
|
20
|
|
|
|
|
1002
|
|
4
|
20
|
|
|
20
|
|
119
|
use Moo; |
|
20
|
|
|
|
|
42
|
|
|
20
|
|
|
|
|
165
|
|
5
|
20
|
|
|
20
|
|
7681
|
use strict; |
|
20
|
|
|
|
|
67
|
|
|
20
|
|
|
|
|
478
|
|
6
|
20
|
|
|
20
|
|
115
|
use warnings; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
8512
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'meta_cache' => ( is => 'lazy', clearer => 'clear_meta_cache', predicate => 'has_meta_cache' ); |
9
|
|
|
|
|
|
|
has 'owner_cache' => ( is => 'ro', weak_ref => 1 ); |
10
|
|
|
|
|
|
|
has 'owner_namespace' => ( is => 'lazy', clearer => 'clear_owner_namespace', predicate => 'has_owner_namespace' ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _build_meta_cache { |
13
|
85
|
|
|
85
|
|
906
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
85
|
|
|
|
|
319
|
my $owner_cache = $self->owner_cache; |
16
|
85
|
|
|
|
|
172
|
my %params = %{ $owner_cache->constructor_params }; |
|
85
|
|
|
|
|
923
|
|
17
|
85
|
|
|
|
|
439
|
delete( @params{qw(l1_cache mirror_cache parent_cache chi_root_class)} ); |
18
|
85
|
|
|
|
|
1757
|
$params{label} = $owner_cache->label . " (meta)"; |
19
|
85
|
|
|
|
|
459
|
$params{namespace} = CHI_Meta_Namespace; |
20
|
85
|
|
|
|
|
555
|
return $owner_cache->chi_root_class->new(%params); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _build_owner_namespace { |
24
|
85
|
|
|
85
|
|
885
|
my ($self) = @_; |
25
|
|
|
|
|
|
|
|
26
|
85
|
|
|
|
|
978
|
return $self->owner_cache->namespace; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub get { |
30
|
2294
|
|
|
2294
|
0
|
21453
|
my ( $self, $key ) = @_; |
31
|
|
|
|
|
|
|
|
32
|
2294
|
|
|
|
|
36386
|
return $self->meta_cache->fetch( $self->_prefixed_key($key) ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set { |
36
|
1812
|
|
|
1812
|
0
|
29851
|
my ( $self, $key, $value ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
1812
|
|
|
|
|
29042
|
return $self->meta_cache->store( $self->_prefixed_key($key), $value ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub remove { |
42
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $key, $value ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
0
|
return $self->meta_cache->remove( $self->_prefixed_key($key) ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _prefixed_key { |
48
|
4106
|
|
|
4106
|
|
32492
|
my ( $self, $key ) = @_; |
49
|
|
|
|
|
|
|
|
50
|
4106
|
|
|
|
|
63905
|
return $self->owner_namespace . ":" . $key; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |