Package com.glitchybyte.glib.cache
Class GExpiringCacheMap<K,V>
java.lang.Object
com.glitchybyte.glib.cache.GExpiringCacheMap<K,V>
- Type Parameters:
K- Type of key.V- Type of value.
- All Implemented Interfaces:
Map<K,V>
Key-value pair cache with expiring entries.
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionGExpiringCacheMap(long amount, TemporalUnit unit) Constructs a cache with the given time-to-live for entries.GExpiringCacheMap(TemporalAmount timeToLive) Constructs a cache with the given time-to-live for entries. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanisEmpty()keySet()voidintsize()values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
GExpiringCacheMap
Constructs a cache with the given time-to-live for entries.- Parameters:
timeToLive- Time to live for a given entry.
-
GExpiringCacheMap
Constructs a cache with the given time-to-live for entries.- Parameters:
amount- The amount of TTL duration.unit- The unit TLL is measured in.
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-