|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.tagtraum.perf.datastructures.RandomCache
Cache with random replacement strategy. Which cached item is replaced depends highly on the hashcode of the cached item. The better the hashfunction, the better this cache.
Constructor Summary | |
RandomCache(int initialCapacity)
Creates a cache with an initial capacity that will be increased to the next power of 2 |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RandomCache(int initialCapacity)
Method Detail |
public int getCapacity()
Cache
getCapacity
in interface Cache
public java.lang.Object get(java.lang.Object key)
Cache
get
in interface Cache
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Cache
put
in interface Cache
public float getHitRatio()
getHitRatio
in interface Cache
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |