/usr/share/perl5/Cache/MemoryCache.pm is in libcache-cache-perl 1.06-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | ######################################################################
# $Id: MemoryCache.pm,v 1.27 2002/04/07 17:04:46 dclinton Exp $
# Copyright (C) 2001-2003 DeWitt Clinton All Rights Reserved
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or
# implied. See the License for the specific language governing
# rights and limitations under the License.
######################################################################
package Cache::MemoryCache;
use strict;
use vars qw( @ISA );
use Cache::BaseCache;
use Cache::Cache qw( $EXPIRES_NEVER );
use Cache::CacheUtils qw( Assert_Defined Static_Params );
use Cache::MemoryBackend;
@ISA = qw ( Cache::BaseCache );
sub Clear
{
foreach my $namespace ( _Namespaces( ) )
{
_Get_Backend( )->delete_namespace( $namespace );
}
}
sub Purge
{
foreach my $namespace ( _Namespaces( ) )
{
_Get_Cache( $namespace )->purge( );
}
}
sub Size
{
my $size = 0;
foreach my $namespace ( _Namespaces( ) )
{
$size += _Get_Cache( $namespace )->size( );
}
return $size;
}
sub _Get_Backend
{
return new Cache::MemoryBackend( );
}
sub _Namespaces
{
return _Get_Backend( )->get_namespaces( );
}
sub _Get_Cache
{
my ( $p_namespace ) = Static_Params( @_ );
Assert_Defined( $p_namespace );
return new Cache::MemoryCache( { 'namespace' => $p_namespace } );
}
sub new
{
my ( $self ) = _new( @_ );
$self->_complete_initialization( );
return $self;
}
sub _new
{
my ( $proto, $p_options_hash_ref ) = @_;
my $class = ref( $proto ) || $proto;
my $self = $class->SUPER::_new( $p_options_hash_ref );
$self->_set_backend( new Cache::MemoryBackend( ) );
return $self;
}
1;
__END__
=pod
=head1 NAME
Cache::MemoryCache -- implements the Cache interface.
=head1 DESCRIPTION
The MemoryCache class implements the Cache interface. This cache
stores data on a per-process basis. This is the fastest of the cache
implementations, but data can not be shared between processes with the
MemoryCache. However, the data will remain in the cache until
cleared, it expires, or the process dies. The cache object simply
going out of scope will not destroy the data.
=head1 SYNOPSIS
use Cache::MemoryCache;
my $cache = new Cache::MemoryCache( { 'namespace' => 'MyNamespace',
'default_expires_in' => 600 } );
See Cache::Cache for the usage synopsis.
=head1 METHODS
See Cache::Cache for the API documentation.
=head1 OPTIONS
See Cache::Cache for standard options.
=head1 PROPERTIES
See Cache::Cache for default properties.
=head1 SEE ALSO
Cache::Cache
=head1 AUTHOR
Original author: DeWitt Clinton <dewitt@unto.net>
Last author: $Author: dclinton $
Copyright (C) 2001-2003 DeWitt Clinton
=cut
|