NAME

GO::AppHandles::AppHandleCachingImpl;

SYNOPSIS

$factory = GO::AppHandles::AppHandleCachingImpl->new( $factory );

All the public API's of this class should come through the
GO::AppHandle class, and are documented there.

DESCRIPTION

implementation of AppHandle for the GO API, which delegates all
function to another AppHandle, but caches all results in
memory. Generally speaking this trades space for speed. If you use
large parts of the GO database, this class will use extremely large
amounts of memory.

This class is somewhat experimental at the moment. It has a number
of flaws.  In particular, it does not implement a true flyweight, so
that for instance a single GO Term is represented by a single
GO::Model::Term object. Different methods, or single methods with
different parameters, which return the same GO term, will return
different Term objects. At the moment some of the methods are
flyweighted. It is possible to flyweight others, but in this case
they will sometimes return objects with the wrong values! You can
read the in code documentation for details.

My own use of the GO API is limited to a small subset of the methods.
So these have been well tested. Others have not, and might be
returning the wrong values anyway!

IMPLEMENTATION

The class works by defining a cache where it stores all the results
from previous method calls.

The cache is just a single big hash. This is keyed on the method
names. The value is another hash. This is keyed dependant on the
function parameters, and the value is the return.

The way the key is calculated for the second parameter depends on
what the types of the parameters are. There are four of different
ways of doing this at the moment.

FEEDBACK

Email p.lord@russet.org.uk

_anonymous_hash_cache

This function generates a hash key on which to cache results, for those
methods which take a single hashref, as a parameter.

_straight_parameter_cache

This function uses the parameter itself directly as a key for
caching results.

_parameter_less_cache

This function works where there are no parameters

_go_terms_cache

For functions which take a GO::Model::Term object.

_cache_function_call

This function calls a second function in the delegated AppHandle, caching
the results. Cached results will be returned the second time around.

Caching is done in a hash, which is keyed on the parameter passed in.

Args - string representing the method to be called.
       arrayref representing the parameters of the method
       string representing the hash to be used for storing the return