Package com.boomi.connector.util
Class ExpiringConnectorCache<K>
- java.lang.Object
-
- com.boomi.connector.util.ConnectorCache<K>
-
- com.boomi.connector.util.ExpiringConnectorCache<K>
-
public class ExpiringConnectorCache<K> extends ConnectorCache<K>
Subclass of ConnectorCache which "expires" after a certain (fixed) amount of time. After the timeToLive provided in the constuctor this ConnectorCache implementation will returnfalse
from theisValid()
method.
-
-
Constructor Summary
Constructors Constructor Description ExpiringConnectorCache(K key, long timeToLive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getExpireTime()
Returns the time (in milliseconds) after which this ConnectorCache is no longer valid.boolean
isValid()
Returnsfalse
if the current time is past the expiration time for this ConnectorCache.-
Methods inherited from class com.boomi.connector.util.ConnectorCache
clearCache, getCache, getKey
-
-
-
-
Constructor Detail
-
ExpiringConnectorCache
public ExpiringConnectorCache(K key, long timeToLive)
- Parameters:
key
- the key by which this ConnectorCache will be cached in the connector cachetimeToLive
- the relative time from now (in milliseconds) after which this ConnectorCache should no longer be considered valid
-
-
Method Detail
-
getExpireTime
public long getExpireTime()
Returns the time (in milliseconds) after which this ConnectorCache is no longer valid.
-
isValid
public boolean isValid()
Returnsfalse
if the current time is past the expiration time for this ConnectorCache. Returnstrue
if this cache should be considered valid,false
otherwise. This method will be called byConnectorCache.getCache(K, X, com.boomi.connector.util.ConnectorCacheFactory<K, C, X>)
whenever a ConnectorCache is retrieved. If this method returnsfalse
, the retrieved ConnectorCache will be discarded and a new one created via the ConnectorCacheFactory provided.Default implementation always returns
true
.- Overrides:
isValid
in classConnectorCache<K>
-
-