public abstract class SingleObjectCache<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected long |
lastRefreshTimestamp |
Modifier | Constructor and Description |
---|---|
protected |
SingleObjectCache(TimeValue refreshInterval,
T initialValue) |
Modifier and Type | Method and Description |
---|---|
T |
getOrRefresh()
Returns the currently cached object and potentially refreshes the cache before returning.
|
protected boolean |
needsRefresh()
Returns
true iff the cache needs to be refreshed. |
protected abstract T |
refresh()
Returns a new instance to cache
|
public T getOrRefresh()
protected abstract T refresh()
protected boolean needsRefresh()
true
iff the cache needs to be refreshed.