public class ExpiryCache<K>
extends java.lang.Object
AgeOutCache
,
ExpiryCache doesn't require a timer task to runModifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ConcurrentMap<K,java.lang.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(java.util.Collection<K> keys) |
int |
removeExpiredElements() |
void |
setTimeout(long timeout) |
int |
size() |
java.lang.String |
toString() |
protected long timeout
protected final java.util.concurrent.ConcurrentMap<K,java.lang.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(java.util.Collection<K> keys)
public int removeExpiredElements()
public void clear()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
protected boolean hasExpired(long val, long current_time)
Copyright © 1998-2020 Red Hat. All Rights Reserved.