|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.onemind.commons.java.datastructure.LookupCache
A lookup cache implements simple lookup caching algorithm for looking up things. The derived class simply implement the produce(Object key) method which is assumed an expensive operation and the results will be cached by the lookup cache implementation. There's no public method on lookup cache, the developer should provide application specific lookup interface.
Constructor Summary | |
LookupCache()
{@inheritDoc} |
|
LookupCache(boolean doNegCache)
{@inheritDoc} |
Method Summary | |
protected void |
clearNegCache()
Clear all the negative cache |
protected boolean |
isInCache(java.lang.Object o)
Test if the key is in cache |
protected boolean |
isInNegCache(java.lang.Object o)
Get whether the object is in negative cache |
protected java.lang.Object |
lookup(java.lang.Object key)
The main lookup method. |
protected abstract java.lang.Object |
produce(java.lang.Object key)
Produce the object given the key. |
protected void |
setDoNegativeCache(boolean b)
Turn on/off the negative cache |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LookupCache()
public LookupCache(boolean doNegCache)
doNegCache
- whether to do negative cachingMethod Detail |
protected final java.lang.Object lookup(java.lang.Object key)
key
- the key
protected abstract java.lang.Object produce(java.lang.Object key)
key
- the key
protected void setDoNegativeCache(boolean b)
b
- true to turn on the neg cacheprotected boolean isInNegCache(java.lang.Object o)
o
- the object
protected boolean isInCache(java.lang.Object o)
o
- the object
protected void clearNegCache()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |