[Biojava-l] Pluggable-heuristics cache package.

Thomas Down td2@sanger.ac.uk
Tue, 23 Jan 2001 13:52:11 +0000


I've just imported a small package I've had lying around in
org.biojava.utils.cache.  I've found this very useful in writing
the biojava-ensembl bridge, and I suspect it will be useful in
other large-database applications.

The idea is that Cache objects act as factories for CacheReferences:

  CacheReference cachedSequence = myCache.makeReference(seq);

CacheReferences are rather like normal java reference objects, but
they're represented by an interface for greater flexibility.

At the moment there are two implementations:

  FixedSizeCache -- Store up to 'n' (configurable) objects.
  SoftReferenceCache -- Store objects using java SoftReferences.


It's easy to write other Cache implementations if you want
a different heuristic.

   Thomas.