This file is indexed.

/usr/share/perl5/Cache/Cache.pm is in libcache-cache-perl 1.08-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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#####################################################################
# $Id: Cache.pm,v 1.43 2005/07/13 22:29:33 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::Cache;


use strict;
use vars qw( @ISA @EXPORT_OK $VERSION $EXPIRES_NOW $EXPIRES_NEVER );
use Exporter;

@ISA = qw( Exporter );

@EXPORT_OK = qw( $VERSION $EXPIRES_NOW $EXPIRES_NEVER );

$VERSION = "1.08";
$EXPIRES_NOW = 'now';
$EXPIRES_NEVER = 'never';


sub Clear;

sub Purge;

sub Size;

sub new;

sub clear;

sub get;

sub get_object;

sub purge;

sub remove;

sub set;

sub set_object;

sub size;

sub get_default_expires_in;

sub get_namespace;

sub set_namespace;

sub get_keys;

sub get_auto_purge_interval;

sub set_auto_purge_interval;

sub get_auto_purge_on_set;

sub set_auto_purge_on_set;

sub get_namespaces;

sub get_identifiers;  # deprecated


1;


__END__


=pod

=head1 NAME

Cache::Cache -- the Cache interface.

=head1 DESCRIPTION

The Cache modules are designed to assist a developer in persisting
data for a specified period of time.  Often these modules are used in
web applications to store data locally to save repeated and redundant
expensive calls to remote machines or databases.  People have also
been known to use Cache::Cache for its straightforward interface in
sharing data between runs of an application or invocations of a
CGI-style script or simply as an easy to use abstraction of the
filesystem or shared memory.

The Cache::Cache interface is implemented by classes that support the
get, set, remove, size, purge, and clear instance methods and their
corresponding static methods for persisting data across method calls.

=head1 CACHE::CACHE VERSUS CHI

Cache::Cache is in wide use and very stable, but has not changed in years
and is no longer actively developed.

L<CHI|CHI> is the successor to Cache::Cache. It adheres to the basic
Cache::Cache API but adds new features and drivers (e.g. FastMmap and
Memcached), improves performance, and addresses limitations in the
Cache::Cache implementation. The authors recommend the use of CHI going forward.

Questions about Cache::Cache and CHI may be directed to the perl-cache
mailing list at http://groups.google.com/group/perl-cache-discuss.

=head1 USAGE

First, choose the best type of cache implementation for your needs.
The simplest cache is the MemoryCache, which is suitable for
applications that are serving multiple sequential requests, and wish
to avoid making redundant expensive queries, such as an
Apache/mod_perl application talking to a database.  If you wish to
share that data between processes, then perhaps the SharedMemoryCache
is appropriate, although its behavior is tightly bound to the
underlying IPC mechanism, which varies from system to system, and is
unsuitable for large objects or large numbers of objects.  When the
SharedMemoryCache is not acceptable, then FileCache offers all of the
same functionality with similar performance metrics, and it is not
limited in terms of the number of objects or their size.  If you wish
to maintain a strict limit on the size of a file system based cache,
then the SizeAwareFileCache is the way to go.  Similarly, the
SizeAwareMemoryCache and the SizeAwareSharedMemoryCache add size
management functionality to the MemoryCache and SharedMemoryCache
classes respectively.

Using a cache is simple.  Here is some sample code for instantiating
and using a file system based cache.

  use Cache::FileCache;

  my $cache = new Cache::FileCache( );

  my $customer = $cache->get( $name );

  if ( not defined $customer )
  {
    $customer = get_customer_from_db( $name );
    $cache->set( $name, $customer, "10 minutes" );
  }

  return $customer;


=head1 CONSTANTS

=over

=item I<$EXPIRES_NEVER>

The item being set in the cache will never expire.

=item I<$EXPIRES_NOW>

The item being set in the cache will expire immediately.

=back

=head1 METHODS

=over

=item B<Clear( )>

Remove all objects from all caches of this type.

=item B<Purge( )>

Remove all objects that have expired from all caches of this type.

=item B<Size( )>

Returns the total size of all objects in all caches of this type.

=item B<new( $options_hash_ref )>

Construct a new instance of a Cache::Cache. I<$options_hash_ref> is a
reference to a hash containing configuration options; see the section
OPTIONS below.

=item B<clear(  )>

Remove all objects from the namespace associated with this cache instance.

=item B<get( $key )>

Returns the data associated with I<$key>.

=item B<get_object( $key )>

Returns the underlying Cache::Object object used to store the cached
data associated with I<$key>.  This will not trigger a removal
of the cached object even if the object has expired.

=item B<purge(  )>

Remove all objects that have expired from the namespace associated
with this cache instance.

=item B<remove( $key )>

Delete the data associated with the I<$key> from the cache.

=item B<set( $key, $data, [$expires_in] )>

Associates I<$data> with I<$key> in the cache. I<$expires_in>
indicates the time in seconds until this data should be erased, or the
constant $EXPIRES_NOW, or the constant $EXPIRES_NEVER.  Defaults to
$EXPIRES_NEVER.  This variable can also be in the extended format of
"[number] [unit]", e.g., "10 minutes".  The valid units are s, second,
seconds, sec, m, minute, minutes, min, h, hour, hours, d, day, days, w,
week, weeks, M, month, months, y, year, and years.  Additionally,
$EXPIRES_NOW can be represented as "now" and $EXPIRES_NEVER can be
represented as "never".

=item B<set_object( $key, $object )>

Associates I<$key> with Cache::Object I<$object>.  Using set_object
(as opposed to set) does not trigger an automatic removal of expired
objects.

=item B<size(  )>

Returns the total size of all objects in the namespace associated with
this cache instance.

=item B<get_namespaces( )>

Returns all the namespaces associated with this type of cache.

=back

=head1 OPTIONS

The options are set by passing in a reference to a hash containing any
of the following keys:

=over

=item I<namespace>

The namespace associated with this cache.  Defaults to "Default" if
not explicitly set.

=item I<default_expires_in>

The default expiration time for objects place in the cache.  Defaults
to $EXPIRES_NEVER if not explicitly set.

=item I<auto_purge_interval>

Sets the auto purge interval.  If this option is set to a particular
time ( in the same format as the expires_in ), then the purge( )
routine will be called during the first set after the interval
expires.  The interval will then be reset.

=item I<auto_purge_on_set>

If this option is true, then the auto purge interval routine will be
checked on every set.

=item I<auto_purge_on_get>

If this option is true, then the auto purge interval routine will be
checked on every get.

=back

=head1 PROPERTIES

=over

=item B<(get|set)_namespace( )>

The namespace of this cache instance

=item B<get_default_expires_in( )>

The default expiration time for objects placed in this cache instance

=item B<get_keys( )>

The list of keys specifying objects in the namespace associated
with this cache instance

=item B<get_identifiers( )>

This method has been deprecated in favor of B<get_keys( )>.

=item B<(get|set)_auto_purge_interval( )>

Accesses the auto purge interval.  If this option is set to a particular
time ( in the same format as the expires_in ), then the purge( )
routine will be called during the first get after the interval
expires.  The interval will then be reset.

=item B<(get|set)_auto_purge_on_set( )>

If this property is true, then the auto purge interval routine will be
checked on every set.

=item B<(get|set)_auto_purge_on_get( )>

If this property is true, then the auto purge interval routine will be
checked on every get.

=back

=head1 SEE ALSO

CHI - the successor to Cache::Cache

Cache::Object, Cache::MemoryCache, Cache::FileCache,
Cache::SharedMemoryCache, and Cache::SizeAwareFileCache

=head1 AUTHOR

Original author: DeWitt Clinton <dewitt@unto.net>

Last author:     $Author: dclinton $

Copyright (C) 2001-2003 DeWitt Clinton

=cut