public abstract class LookupCache
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map |
_cache
the hit cache *
|
private boolean |
_doNegCache
indicate whether to do negative caching *
|
private static java.util.logging.Logger |
_logger
the logger *
|
private java.util.Set |
_negCache
the negative cache *
|
Constructor and Description |
---|
LookupCache() |
LookupCache(boolean doNegCache) |
Modifier and Type | Method and Description |
---|---|
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
|
private static final java.util.logging.Logger _logger
private java.util.Map _cache
private java.util.Set _negCache
private boolean _doNegCache
public LookupCache()
public LookupCache(boolean doNegCache)
doNegCache
- whether to do negative cachingprotected final java.lang.Object lookup(java.lang.Object key)
key
- the keyprotected abstract java.lang.Object produce(java.lang.Object key)
key
- the keyprotected void setDoNegativeCache(boolean b)
b
- true to turn on the neg cacheprotected boolean isInNegCache(java.lang.Object o)
o
- the objectprotected boolean isInCache(java.lang.Object o)
o
- the objectprotected void clearNegCache()