The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Cache::SizeAwareFileCache -- extends the Cache::FileCache module

DESCRIPTION

The Cache::SizeAwareFileCache module adds the ability to dynamically limit the size (in bytes) of a file system based cache. It offers the new 'max_size' option and the 'limit_size( $size )' method. Please see the documentation for Cache::FileCache for more information.

SYNOPSIS

  use Cache::SizeAwareFileCache;

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

  my $size_aware_file_cache =
    new Cache::SizeAwareFileCache( \%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 SizeAwareFileCache

$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

limit_size( $new_size )

See Cache::SizeAwareCache. NOTE: This is not 100% accurate, as the current size is calculated from the size of the objects in the cache, and does not include the size of the directory inodes.

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:

max_size

See Cache::SizeAwareCache

PROPERTIES

See Cache::Cache for default properties.

(get|set)_max_size

See Cache::SizeAwareCache

get_identifiers

See Cache::FileCache

SEE ALSO

Cache::Cache, Cache::SizeAwareCache, Cache::FileCache

AUTHOR

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

Also: Portions of this code are a rewrite of David Coppit's excellent extentions to the original File::Cache

Last author: $Author: dclinton $

Copyright (C) 2001 DeWitt Clinton