NAME
Cache::CacheMetaData -- data about objects in the cache
DESCRIPTION
The CacheMetaData object is used by size aware caches to keep track of the state of the cache and effeciently return information such as an objects size or an ordered list of indentifiers to be removed when a cache size is being limited. End users will not normally use CacheMetaData directly.
SYNOPSIS
use Cache::CacheMetaData;
my $cache_meta_data = new Cache::CacheMetaData( );
$cache_meta_data->insert( $object );
my $current_size = $cache_meta_data->get_cache_size( );
my @removal_list;
$cache_meta_data->build_removal_list( \@removal_list );
METHODS
- new( )
-
Construct a new Cache::CacheMetaData object
- insert( $object )
-
Inform the CacheMetaData about an object in the cache.
$object
-
The object to be examined for its meta data
- remove( $identifier )
-
Inform the CacheMetaData that an object is no longer in the cache
identifier
-
The key under which the object was stored.
- build_removal_list( $removal_list_ref )
-
Create a list of the identifiers in the cache, ordered as follows:
1) objects that expire now
2) objects expiring at a particular time, with ties broken by the time at which they were least recently accessed
3) objects that never expire, sub ordered by the time at which they were least recently accessed
NOTE: This could be improved further by taking the size into account on accessed_at ties. However, this type of tie is unlikely in normal usage.
removal_list_ref
-
A reference to the list that should hold the result
- build_object_size( $identifier, $object_size_ref )
-
Determine the size of an object that the CacheMetaData knows about
identifier
-
The key under which the object was stored.
object_size_ref
-
A reference to the scalar that should hold the result
PROPERTIES
- get_cache_size
-
The total size of the objects in the cache
SEE ALSO
Cache::Cache
AUTHOR
Original author: DeWitt Clinton <dewitt@unto.net>
Last author: $Author: dclinton $
Copyright (C) 2001 DeWitt Clinton