T - type to returnpublic class CachedContent<T> extends Object
| Constructor and Description |
|---|
CachedContent(long lifespan,
ResourceRefresher<T> refresh) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
forceRefresh()
Force a refresh and reset the expiry counter
|
T |
get()
Get the value, triggering a refresh if needed
|
T |
getCachedValue()
Get the cached value without any expiry check
|
long |
getLifespan()
Get the lifespan in millis of the cached value
|
int |
getRefreshCounter() |
boolean |
maybeRefresh()
Maybe refresh the content
|
protected long |
now() |
String |
toString() |
public CachedContent(long lifespan,
ResourceRefresher<T> refresh)
public T get() throws Exception
Exceptionpublic T getCachedValue()
public int getRefreshCounter()
public long getLifespan()
public boolean maybeRefresh()
throws Exception
Exceptionprotected long now()
protected T forceRefresh() throws Exception
ExceptionCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.