K
- The type of the key to storeV
- The type of the value to storepublic class ExpiringCache<K,V> extends Object implements Map<K,V>
Constructor and Description |
---|
ExpiringCache(int expireTimeMs)
Expiring cache constructor
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears all mapping from the cache
|
boolean |
containsKey(Object key)
Checks if the cache contains a specific key
|
boolean |
containsValue(Object value)
Checks if the cache contains a specific value
|
Set<Map.Entry<K,V>> |
entrySet()
Returns a
Set view of the keys |
V |
get(Object key)
Retrieves the value from a key
|
int |
getExpireTime()
Accessor method for expireTimeMs
|
boolean |
isEmpty()
Checks whether or not it is empty
|
Set<K> |
keySet()
Returns a
Set view of the keys |
V |
put(K key,
V value)
Associates a specificed value with a specified key in this map
|
void |
putAll(Map<? extends K,? extends V> m)
Copies the content from one map to the current map
|
V |
remove(Object key)
Removes the mapping for a key if it's present.
|
void |
setExpireTime(int expireTimeMs)
Mutator method for expireTimeMs.
|
int |
size()
Retrieves the number of items stored
|
Collection<V> |
values()
Returns a
Collection view of the keys |
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 ExpiringCache(int expireTimeMs)
expireTimeMs
- The expired time in Mspublic void setExpireTime(int expireTimeMs)
expireTimeMs
- The expired time in Mspublic int getExpireTime()
public int size()
public boolean isEmpty()
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
key
- The key to search forpublic boolean containsValue(Object value)
containsValue
in interface Map<K,V>
value
- The value to search forpublic void putAll(Map<? extends K,? extends V> m)
public void clear()
public Collection<V> values()
Collection
view of the keysCopyright © 1997-2021 PostgreSQL Global Development Group. All Rights Reserved.