public class ExpiryCache<K> extends Object
AgeOutCache,
ExpiryCache doesn't require a timer task to run| Modifier 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 boolean |
hasExpired(long val,
long current_time) |
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 boolean hasExpired(long val,
long current_time)
Copyright © 2025 JBoss, a division of Red Hat. All rights reserved.