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