K - key typeV - value typepublic abstract class GenericLastValuesCache<K,V> extends java.lang.Object implements CacheElement<K,V>, java.io.Serializable
| Constructor and Description |
|---|
GenericLastValuesCache() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
cacheNulls()
By default
null values returned by resolve(Object) will be cached, meaning that the
function won't be called again for keys for which it was determined that there is no value associated. |
V |
get(K key)
The cached entry is most probably a hash of some sort.
|
protected int |
getMaximumSize()
This function gives the maximum number of entries that are allowed in the cache.
|
int |
getRefreshTime()
The desired refresh time, in seconds.
|
void |
refresh()
Update the contents of the cache entry.
|
V |
refresh(K key)
Force a refresh of this key.
|
void |
remove(K key)
Remove the entry for this key, so that the next request will force a refresh, of this key only.
|
protected abstract V |
resolve(K key)
You should implement here a way of finding out the value for a given key.
|
protected int getMaximumSize()
protected boolean cacheNulls()
null values returned by resolve(Object) will be cached, meaning that the
function won't be called again for keys for which it was determined that there is no value associated. You can override
this function to return false if you don't want to cache null return values but keep asking
for the missing value until there is a positive answer.true to enable null caching, false to disable it.public V get(K key)
CacheElementget in interface CacheElement<K,V>key - some unique keyprotected abstract V resolve(K key)
key - public void remove(K key)
key - key to removepublic V refresh(K key)
key - public void refresh()
CacheElementrefresh in interface CacheElement<K,V>public int getRefreshTime()
CacheElementCacheElement.refresh() method is called.getRefreshTime in interface CacheElement<K,V>CacheElement.refresh()