public abstract class CachedExternalValue extends Object implements ExternalValue
For example imagine a value that is the number of users in a system. This may be expensive to compute (lots of database calls maybe) but its still fairly accurate if its only done every 1-5 minutes say.
| Modifier | Constructor and Description |
|---|---|
protected |
CachedExternalValue()
By default 1 minute is the cache time out value
|
protected |
CachedExternalValue(long cacheTimeout,
TimeUnit cacheTimeoutUnits)
Creates a CachedExternalValue where the cache time is the values specified.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract long |
computeValue()
This method is called to compute the value of the
ExternalValue |
long |
getValue() |
protected CachedExternalValue()
protected CachedExternalValue(long cacheTimeout,
TimeUnit cacheTimeoutUnits)
cacheTimeout - the cache time out valuecacheTimeoutUnits - the units of the cache time our valueprotected abstract long computeValue()
ExternalValue
This will be done because the cached value has expired and has since been requested via a call to getValue()
public long getValue()
getValue in interface ExternalValueCopyright © 2016 Atlassian. All rights reserved.