line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
###################################################################### |
3
|
|
|
|
|
|
|
# $Id: MemoryCache.pm,v 1.28 2003/04/15 14:46:23 dclinton Exp $ |
4
|
|
|
|
|
|
|
# Copyright (C) 2001-2003 DeWitt Clinton All Rights Reserved |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Software distributed under the License is distributed on an "AS |
7
|
|
|
|
|
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or |
8
|
|
|
|
|
|
|
# implied. See the License for the specific language governing |
9
|
|
|
|
|
|
|
# rights and limitations under the License. |
10
|
|
|
|
|
|
|
###################################################################### |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Cache::MemoryCache; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
659
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
16
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
17
|
1
|
|
|
1
|
|
759
|
use vars qw( @ISA ); |
|
1
|
|
|
|
|
16562
|
|
|
1
|
|
|
|
|
44
|
|
18
|
1
|
|
|
1
|
|
8
|
use Cache::BaseCache; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
125
|
|
19
|
1
|
|
|
1
|
|
5
|
use Cache::Cache qw( $EXPIRES_NEVER ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
20
|
1
|
|
|
1
|
|
895
|
use Cache::CacheUtils qw( Assert_Defined Static_Params ); |
|
1
|
|
|
|
|
609
|
|
|
1
|
|
|
|
|
420
|
|
21
|
|
|
|
|
|
|
use Cache::MemoryBackend; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@ISA = qw ( Cache::BaseCache ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub Clear |
27
|
0
|
|
|
0
|
1
|
0
|
{ |
28
|
|
|
|
|
|
|
foreach my $namespace ( _Namespaces( ) ) |
29
|
0
|
|
|
|
|
0
|
{ |
30
|
|
|
|
|
|
|
_Get_Backend( )->delete_namespace( $namespace ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub Purge |
36
|
0
|
|
|
0
|
1
|
0
|
{ |
37
|
|
|
|
|
|
|
foreach my $namespace ( _Namespaces( ) ) |
38
|
0
|
|
|
|
|
0
|
{ |
39
|
|
|
|
|
|
|
_Get_Cache( $namespace )->purge( ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub Size |
45
|
0
|
|
|
0
|
1
|
0
|
{ |
46
|
|
|
|
|
|
|
my $size = 0; |
47
|
0
|
|
|
|
|
0
|
|
48
|
|
|
|
|
|
|
foreach my $namespace ( _Namespaces( ) ) |
49
|
0
|
|
|
|
|
0
|
{ |
50
|
|
|
|
|
|
|
$size += _Get_Cache( $namespace )->size( ); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
0
|
|
53
|
|
|
|
|
|
|
return $size; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _Get_Backend |
58
|
0
|
|
|
0
|
|
0
|
{ |
59
|
|
|
|
|
|
|
return new Cache::MemoryBackend( ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _Namespaces |
64
|
0
|
|
|
0
|
|
0
|
{ |
65
|
|
|
|
|
|
|
return _Get_Backend( )->get_namespaces( ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _Get_Cache |
70
|
0
|
|
|
0
|
|
0
|
{ |
71
|
|
|
|
|
|
|
my ( $p_namespace ) = Static_Params( @_ ); |
72
|
0
|
|
|
|
|
0
|
|
73
|
|
|
|
|
|
|
Assert_Defined( $p_namespace ); |
74
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
return new Cache::MemoryCache( { 'namespace' => $p_namespace } ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub new |
80
|
1
|
|
|
1
|
1
|
19
|
{ |
81
|
|
|
|
|
|
|
my ( $self ) = _new( @_ ); |
82
|
1
|
|
|
|
|
9
|
|
83
|
|
|
|
|
|
|
$self->_complete_initialization( ); |
84
|
1
|
|
|
|
|
31
|
|
85
|
|
|
|
|
|
|
return $self; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub _new |
90
|
1
|
|
|
1
|
|
3
|
{ |
91
|
1
|
|
33
|
|
|
8
|
my ( $proto, $p_options_hash_ref ) = @_; |
92
|
1
|
|
|
|
|
13
|
my $class = ref( $proto ) || $proto; |
93
|
1
|
|
|
|
|
144
|
my $self = $class->SUPER::_new( $p_options_hash_ref ); |
94
|
1
|
|
|
|
|
24
|
$self->_set_backend( new Cache::MemoryBackend( ) ); |
95
|
|
|
|
|
|
|
return $self; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |