line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
###################################################################### |
2
|
|
|
|
|
|
|
# $Id: YAMLCache.pm,v 1.2 2005/10/26 16:18:30 nachbaur Exp $ |
3
|
|
|
|
|
|
|
# Copyright (C) 2005 Michael Nachbaur 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::YAMLCache; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5772
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
16
|
1
|
|
|
1
|
|
4
|
use vars qw( @ISA $VERSION ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
17
|
1
|
|
|
1
|
|
809
|
use Cache::FileCache; |
|
1
|
|
|
|
|
71772
|
|
|
1
|
|
|
|
|
46
|
|
18
|
1
|
|
|
1
|
|
8
|
use Cache::CacheUtils qw ( Assert_Defined Build_Path Static_Params ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
19
|
1
|
|
|
1
|
|
504
|
use Cache::YAMLBackend; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
207
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$VERSION = "0.01"; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@ISA = qw ( Cache::FileCache ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# by default, the root of the cache is located in 'YAMLCache'. On a |
27
|
|
|
|
|
|
|
# UNIX system, this will appear in "/tmp/YAMLCache/" |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $DEFAULT_CACHE_ROOT = "YAMLCache"; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _Get_Backend |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
|
|
my ( $p_optional_cache_root ) = Static_Params( @_ ); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return new Cache::YAMLBackend( _Build_Cache_Root( $p_optional_cache_root ) ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _Get_Cache |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
0
|
|
|
my ( $p_namespace, $p_optional_cache_root ) = Static_Params( @_ ); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
Assert_Defined( $p_namespace ); |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ( defined $p_optional_cache_root ) |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
|
|
|
return new Cache::YAMLCache( { 'namespace' => $p_namespace, |
49
|
|
|
|
|
|
|
'cache_root' => $p_optional_cache_root } ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
|
return new Cache::YAMLCache( { 'namespace' => $p_namespace } ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _initialize_file_backend |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
0
|
|
|
my ( $self ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$self->_set_backend( new Cache::YAMLBackend( $self->_get_initial_root( ), |
64
|
|
|
|
|
|
|
$self->_get_initial_depth( ), |
65
|
|
|
|
|
|
|
$self->_get_initial_umask( ) )); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |