line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::ObjectStore::Cache; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
51
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
518
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
21
|
|
|
21
|
0
|
909
|
my( $cls, $size ) = @_; |
8
|
21
|
|
|
|
|
101
|
return bless [ $size, {}, {} ], $cls; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub empty { |
12
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
13
|
1
|
|
|
|
|
2
|
$self->[1] = {}; |
14
|
1
|
|
|
|
|
4
|
$self->[2] = {}; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub fetch { |
18
|
7
|
|
|
7
|
0
|
1973
|
my( $self, $key ) = @_; |
19
|
7
|
|
|
|
|
12
|
my( $size, $c1, $c2 ) = @$self; |
20
|
7
|
|
|
|
|
10
|
my $v = $c1->{$key}; |
21
|
7
|
100
|
|
|
|
15
|
unless( $v ) { |
22
|
6
|
|
|
|
|
9
|
$v = $c2->{$key}; |
23
|
6
|
100
|
|
|
|
12
|
if( $v ) { |
24
|
4
|
|
|
|
|
64
|
$self->stow( $key, $v ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
7
|
|
|
|
|
27
|
return $v; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub stow { |
31
|
552
|
|
|
552
|
0
|
980
|
my( $self, $key, $val ) = @_; |
32
|
552
|
|
|
|
|
979
|
my( $size, $c1, $c2 ) = @$self; |
33
|
552
|
|
|
|
|
1434
|
$c1->{$key} = $val; |
34
|
552
|
100
|
|
|
|
1626
|
if( scalar( keys( %$c1 ) ) > $size ) { |
35
|
3
|
|
|
|
|
4
|
$self->[1] = {}; |
36
|
3
|
|
|
|
|
9
|
$self->[2] = $c1; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub entries { |
41
|
2
|
|
|
2
|
0
|
294
|
my $self = shift; |
42
|
2
|
|
|
|
|
5
|
my( $size, $c1, $c2 ) = @$self; |
43
|
2
|
|
|
|
|
7
|
my( %e ) = ( %$c1, %$c2 ); |
44
|
2
|
|
|
|
|
10
|
return keys %e; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |