Constructor and Description |
---|
ExpirationCache(int maxSize,
long defaultExpirationTime)
Construct a new expiration cache.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key)
Deprecated.
|
int |
getMaxCacheSize()
Return the maximum cache Size.
|
boolean |
isEmpty() |
Set<K> |
keySet() |
V |
lookup(K key)
Returns the value of the specified key, or
null . |
V |
put(K key,
V value)
Put a value in the cache.
|
V |
put(K key,
V value,
long expirationTime)
Put a value in the cahce with the specified expiration time in milliseconds.
|
void |
putAll(Map<? extends K,? extends V> m) |
V |
remove(Object key)
Remove a entry with the given key from the cache.
|
void |
setDefaultExpirationTime(long defaultExpirationTime)
Set the default expiration time in milliseconds.
|
void |
setMaxCacheSize(int maxCacheSize)
Set the maximum cache size.
|
int |
size() |
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public ExpirationCache(int maxSize, long defaultExpirationTime)
maxSize
- the maximum size.defaultExpirationTime
- the default expiration time in milliseconds.public void setDefaultExpirationTime(long defaultExpirationTime)
defaultExpirationTime
- the default expiration time.public V put(K key, V value, long expirationTime)
key
- the key of the value.value
- the value.expirationTime
- the expiration time in milliseconds.null
.public V lookup(K key)
Cache
null
.@Deprecated public V get(Object key)
Cache
null
.public int getMaxCacheSize()
Cache
getMaxCacheSize
in interface Cache<K,V>
public void setMaxCacheSize(int maxCacheSize)
Cache
setMaxCacheSize
in interface Cache<K,V>
maxCacheSize
- the new maximum cache size.public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>