public class ExpiryCache<K> extends Object
AgeOutCache
,
ExpiryCache doesn't require a timer task to runModifier and Type | Field and Description |
---|---|
protected ConcurrentMap<K,Long> |
map |
protected long |
timeout |
Constructor and Description |
---|
ExpiryCache(long timeout)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
addIfAbsentOrExpired(K key) |
void |
clear() |
boolean |
contains(K key) |
long |
getTimeout() |
boolean |
hasExpired(K key) |
protected static boolean |
hasExpired(long val) |
void |
remove(K key) |
void |
removeAll(Collection<K> keys) |
int |
removeExpiredElements() |
void |
setTimeout(long timeout) |
int |
size() |
String |
toString() |
protected long timeout
protected final ConcurrentMap<K,Long> map
public ExpiryCache(long timeout)
timeout
- Timeout in mspublic long getTimeout()
public void setTimeout(long timeout)
public boolean addIfAbsentOrExpired(K key)
public boolean contains(K key)
public boolean hasExpired(K key)
public void remove(K key)
public void removeAll(Collection<K> keys)
public int removeExpiredElements()
public void clear()
public int size()
protected static boolean hasExpired(long val)
Copyright © 2013 JBoss, a division of Red Hat. All rights reserved.