Class VersionedCacheMap<K,V>
- java.lang.Object
-
- com.identityworksllc.iiq.common.cache.CacheMap<K,V>
-
- com.identityworksllc.iiq.common.cache.VersionedCacheMap<K,V>
-
- Type Parameters:
K
- The key typeV
- The value type
- All Implemented Interfaces:
Serializable
,Function<K,Optional<V>>
,Map<K,V>
public class VersionedCacheMap<K,V> extends CacheMap<K,V> implements Serializable
A variant onCacheMap
intended for use in plugin-heavy environments, when you may want to clear a cache upon plugin installation or update.An entry will be considered expired when
CacheEntry.isExpired()
returns true or else when the plugin version has changed.All other behavior is identical.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.identityworksllc.iiq.common.cache.CacheMap
CacheMap.CacheMapEntry, CacheMap.CacheMapEntrySet
-
-
Constructor Summary
Constructors Constructor Description VersionedCacheMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CacheEntry<V>
cache(V value)
Caches the value using aVersionedCacheEntry
void
putAllInternal(CacheMap<? extends K,? extends V> other)
Puts all cache entries from another CacheMap into this one.-
Methods inherited from class com.identityworksllc.iiq.common.cache.CacheMap
apply, beforeExpiration, clear, containsKey, containsValue, entrySet, get, getInternalMap, getNewExpirationDate, getSecondsRemaining, invalidateRecords, isEmpty, keySet, put, putAll, remove, size, snapshot, values, withBeforeExpirationHook
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
VersionedCacheMap
public VersionedCacheMap()
-
-
Method Detail
-
cache
protected CacheEntry<V> cache(V value)
Caches the value using aVersionedCacheEntry
-
putAllInternal
public void putAllInternal(CacheMap<? extends K,? extends V> other)
Description copied from class:CacheMap
Puts all cache entries from another CacheMap into this one.They will be copied as CacheEntry objects, thus retaining their expiration timestamps. Expired entries will not be copied.
- Overrides:
putAllInternal
in classCacheMap<K,V>
- Parameters:
other
- The other CacheMap object- See Also:
CacheMap.putAllInternal(CacheMap)
-
-