Package org.jgroups.util
Class ExpiryCache<K>
java.lang.Object
org.jgroups.util.ExpiryCache<K>
Cache which maintains timestamps for keys, and methods to remove/replace expired keys. Compared to
AgeOutCache,
ExpiryCache doesn't require a timer task to run- Version:
- 3.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddIfAbsentOrExpired(K key) voidclear()booleanlongprotected booleanhasExpired(long val, long current_time) booleanhasExpired(K key) voidvoidremoveAll(Collection<K> keys) intvoidsetTimeout(long timeout) intsize()toString()
-
Field Details
-
timeout
protected long timeout -
map
-
-
Constructor Details
-
ExpiryCache
public ExpiryCache(long timeout) Creates a new instance- Parameters:
timeout- Timeout in ms
-
-
Method Details
-
getTimeout
public long getTimeout() -
setTimeout
public void setTimeout(long timeout) -
addIfAbsentOrExpired
-
contains
-
hasExpired
-
remove
-
removeAll
-
removeExpiredElements
public int removeExpiredElements() -
clear
public void clear() -
size
public int size() -
toString
-
hasExpired
protected boolean hasExpired(long val, long current_time)
-