com.tagtraum.perf.datastructures
Interface Cache

All Known Implementing Classes:
LRUCache, RandomCache

public interface Cache

Interface for caches.

Version:
$Id: $
Author:
Hendrik Schreiber

Method Summary
 java.lang.Object get(java.lang.Object key)
          Retrieves an object from this cache using the given key.
 int getCapacity()
          Returns the capacity of this cache.
 float getHitRatio()
          Returns a number between 0.0 and 1.0. 1.0 is a 100% hit rate.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Registers an object under a key in this cache.
 

Method Detail

getCapacity

public int getCapacity()
Returns the capacity of this cache. The exact meaning of this value is implementation dependent.


get

public java.lang.Object get(java.lang.Object key)
Retrieves an object from this cache using the given key.

Returns:
null if the object is not in this cache (anymore)

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Registers an object under a key in this cache.


getHitRatio

public float getHitRatio()
Returns a number between 0.0 and 1.0. 1.0 is a 100% hit rate.



Copyright © 2002 Hendrik Schreiber
http://www.tagtraum.com/performance/
This software can be distributed under LGPL