E - The type of the cached variablepublic abstract class Cache<E> extends Object
| Constructor and Description | 
|---|
Cache(long timeMS)
Notes the timed intervals in milliseconds for cache refreshing, and
 refreshes the cache for the first time 
 | 
Cache(long timeMS,
     boolean forceRefresh)
Notes the timed intervals in milliseconds for cache refreshing, and
 refreshes the cache for the first time 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
forceRefresh()
Forcibly refreshes the current value of this  
Cache | 
E | 
get()
Calls a check to see if the cache needs to be updated, and returns the
 stored variable 
 | 
protected E | 
getCurrentValue()
Returns the currently in-use variable without checking the cache 
 | 
protected void | 
setCurrentValue(E value)
Sets the value of this  
Cache | 
protected abstract void | 
update()
Called when a variable needs to be updated. 
 | 
public Cache(long timeMS)
timeMS - The time to wait between refreshes in millisecondspublic Cache(long timeMS,
             boolean forceRefresh)
timeMS - The time to wait between refreshes in millisecondsforceRefresh - true to refresh and retrieve the cached
                     instance upon construction, instead of on the first
                     call to get()public final E get()
Cacheprotected abstract void update()
protected E getCurrentValue()
Cacheprotected void setCurrentValue(E value)
Cachevalue - The new value to setpublic final void forceRefresh()
CacheCopyright © 2017. All rights reserved.