public interface RefreshController<T>
Modifier and Type | Method and Description |
---|---|
long |
calculateNextRefreshTime(T _oldObject,
T _newObject,
long _timeOfLastRefresh,
long _fetchTime)
Returns the time of next refresh (expiry time) in milliseconds since epoch.
|
long calculateNextRefreshTime(T _oldObject, T _newObject, long _timeOfLastRefresh, long _fetchTime)
Long.MAX_VALUE
is returned it means
there is no specific expiry time known or needed. In case a reasonable
default can be assumed for the expiry, the cache will use the
configured expiry time.
The cache may call the method a second (or more) times, if the expiry time needs a recalculation. The reason for this is to react on possible configuration changes properly. This may happen when an entry is read back from storage.
_oldObject
- the value currently in the cache. null if it is not
in the cache, is a null value (null is supported for values)
or the previous fetch operation yielded in an exception._timeOfLastRefresh
- time of the last cache refresh, by put or from the cache source._newObject
- the value which will be put in the cache._fetchTime
- this is the current time in millis. If a cache source was used to
fetch the value, this is the time before the fetch was started.cache2k API documentation. Copyright © 2000–2016 headissue GmbH, Munich.