XAO::DO::Cache::Memory - memory storage back-end for XAO::Cache


XAO-Base documentation  | view source Contained in the XAO-Base distribution.

Index


NAME

Top

XAO::DO::Cache::Memory - memory storage back-end for XAO::Cache

SYNOPSIS

Top

You should not use this object directly, it is a back-end for XAO::Cache.

 if($backend->exists(\@c)) {
     return $backend->get(\@c);
 }

DESCRIPTION

Top

Cache::Memory is the default implementation of XAO::Cache back-end. It stores data in memory.

METHODS

Top

calculate_size ($)

Calculates size in bytes of the given reference.

drop (@)

Drops an element from the cache.

exists (@)

Checks if an element exists in the cache. Does not update its access time, but checks it. If the element should be expired it removes it from the cache and returns false.

get (\@)

Retrieves an element from the cache. Does not check if it is expired or not, that is done in exists() method and does not update access time.

make_key (\@)

Makes a key from the given list of coordinates.

put (\@\$)

Add a new element to the cache; before adding it checks cache size and throws out elements to make space for the new element. Order of removal depends on when an element was accessed last.

setup (%)

Sets expiration time and maximum cache size.

PRIVATE METHODS

Top

###############################################################################

drop_oldest ($)

Drops oldest element from the cache using supplied key and element.

Prints cache as a chain from the most recent to the least recent. The order is most_recent->next->...->next->least_recent.

touch ($)

Private method that updates access time and moves an element to the most recent position.

AUTHORS

Top

Copyright (c) 2002 XAO Inc.

Andrew Maltsev <am@xao.com>.

SEE ALSO

Top

Have a look at: XAO::DO::Cache::Memory, XAO::Objects, XAO::Base, XAO::FS, XAO::Web.


XAO-Base documentation  | view source Contained in the XAO-Base distribution.