The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Cache::FileCache -- implements the Cache interface.

DESCRIPTION

The FileCache class implements the Cache interface. This cache stores data in the filesystem so that it can be shared between processes.

SYNOPSIS

  use Cache::FileCache;

  my %cache_options = ( 'namespace' => 'MyNamespace',
                        'default_expires_in' => 600 );

  my $file_cache = new Cache::FileCache( \%cache_options ) or
    croak( "Couldn't instantiate FileCache" );

METHODS

Clear( $optional_cache_root )

See Cache::Cache

$optional_cache_root

If specified, this indicates the root on the filesystem of the cache to be cleared.

Purge( $optional_cache_root )

See Cache::Cache

$optional_cache_root

If specified, this indicates the root on the filesystem of the cache to be purged.

Size( $optional_cache_root )

See Cache::Cache

$optional_cache_root

If specified, this indicates the root on the filesystem of the cache to be sized.

new( $options_hash_ref )

Constructs a new FileCache.

$options_hash_ref

A reference to a hash containing configuration options for the cache. See the section OPTIONS below.

clear( )

See Cache::Cache

get( $identifier )

See Cache::Cache

get_object( $identifier )

See Cache::Cache

purge( )

See Cache::Cache

remove( $identifier )

See Cache::Cache

set( $identifier, $data, $expires_in )

See Cache::Cache

size( )

See Cache::Cache

OPTIONS

See Cache::Cache for standard options. Additionally, options are set by passing in a reference to a hash containing any of the following keys:

cache_root

The location in the filesystem that will hold the root of the cache. Defaults to the 'FileCache' under the OS default temp directory ( often '/tmp' on UNIXes ) unless explicitly set.

cache_depth

The number of subdirectories deep to cache object item. This should be large enough that no cache directory has more than a few hundred objects. Defaults to 3 unless explicitly set.

directory_umask

The directories in the cache on the filesystem should be globally writable to allow for multiple users. While this is a potential security concern, the actual cache entries are written with the user's umask, thus reducing the risk of cache poisoning. If you desire it to only be user writable, set the 'directory_umask' option to '077' or similar. Defaults to '000' unless explicitly set.

PROPERTIES

See Cache::Cache for default properties.

(get|set)_cache_root

The root on the filesystem of this cache.

(get|set)_cache_depth

The number of subdirectories deep to cache each object.

(get|set)_directory_umask

The directories in the cache on the filesystem should be globally writable to allow for multiple users. While this is a potential security concern, the actual cache entries are written with the user's umask, thus reducing the risk of cache poisoning. If you desire it to only be user writable, set the 'directory_umask' option to '077' or similar.

get_identifiers

The list of identifiers specifying objects in the namespace associated with this cache instance. For FileCache implementations, the get_identifiers routine must actual examine each stored item in the cache, and it is therefore an expensive operation.

SEE ALSO

Cache::Cache

AUTHOR

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

Last author: $Author: dclinton $

Copyright (C) 2001 DeWitt Clinton