Package com.atlassian.cache.hazelcast
Class HazelcastAsyncHybridCache<K,V>
java.lang.Object
com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
com.atlassian.cache.hazelcast.HazelcastAsyncHybridCache<K,V>
- All Implemented Interfaces:
com.atlassian.cache.Cache<K,,V> com.atlassian.cache.ManagedCache,com.atlassian.cache.ReadThroughCache<K,V>
public class HazelcastAsyncHybridCache<K,V>
extends ManagedHybridCacheSupport
implements com.atlassian.cache.Cache<K,V>
Implementation of
ManagedCache and Cache that does not require the values to be Serializable.
It works by caching values locally and broadcasting invalidations cluster-wide using a Hazelcast ITopic.
Cache entries are invalidated when the cache is modified through one of the methods clear(), remove(K),
replace(K, V, V), or put(K, V) (when it overwrites an existing value).
- Since:
- 2.12.0
-
Field Summary
Fields inherited from class com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
cacheManager, name -
Constructor Summary
ConstructorsConstructorDescriptionHazelcastAsyncHybridCache(String name, com.atlassian.cache.CacheFactory localCacheFactory, com.hazelcast.topic.ITopic<com.atlassian.cache.hazelcast.HazelcastAsyncHybridCache.Invalidate> invalidationTopic, com.atlassian.cache.CacheLoader<K, V> cacheLoader, HazelcastCacheManager cacheManager, com.atlassian.cache.CacheSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(com.atlassian.cache.CacheEntryListener<K, V> listener, boolean includeValues) voidclear()booleancontainsKey(K key) Provide an overriden implementation ofReadThroughCache.getBulk(Set, Function)that just delegates to the local cache.getKeys()protected com.atlassian.cache.ManagedCachegetName()booleanbooleanvoidputIfAbsent(K key, V value) voidbooleanvoidvoidremoveListener(com.atlassian.cache.CacheEntryListener<K, V> listener) booleanMethods inherited from class com.atlassian.cache.hazelcast.ManagedHybridCacheSupport
currentExpireAfterAccessMillis, currentExpireAfterWriteMillis, currentMaxEntries, getStatistics, isLocal, isReplicateViaCopy, isStatisticsEnabled, setStatistics, updateExpireAfterAccess, updateExpireAfterWrite, updateMaxEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.cache.ManagedCache
getCacheCollector
-
Constructor Details
-
HazelcastAsyncHybridCache
public HazelcastAsyncHybridCache(String name, com.atlassian.cache.CacheFactory localCacheFactory, com.hazelcast.topic.ITopic<com.atlassian.cache.hazelcast.HazelcastAsyncHybridCache.Invalidate> invalidationTopic, com.atlassian.cache.CacheLoader<K, V> cacheLoader, HazelcastCacheManager cacheManager, com.atlassian.cache.CacheSettings settings)
-
-
Method Details
-
clear
public void clear()- Specified by:
clearin interfacecom.atlassian.cache.ManagedCache
-
containsKey
-
get
-
get
-
getBulk
@Nonnull public Map<K,V> getBulk(@Nonnull Set<K> keys, @Nonnull Function<Set<K>, Map<K, V>> valuesSupplier) Provide an overriden implementation ofReadThroughCache.getBulk(Set, Function)that just delegates to the local cache. This prevents calls toput(Object, Object)from the default implementation triggering unwanted invalidations. -
getKeys
-
getName
- Specified by:
getNamein interfacecom.atlassian.cache.ManagedCache- Specified by:
getNamein interfacecom.atlassian.cache.ReadThroughCache<K,V> - Overrides:
getNamein classManagedHybridCacheSupport
-
isFlushable
public boolean isFlushable()- Specified by:
isFlushablein interfacecom.atlassian.cache.ManagedCache
-
isReplicateAsynchronously
public boolean isReplicateAsynchronously()- Specified by:
isReplicateAsynchronouslyin interfacecom.atlassian.cache.ManagedCache
-
put
-
putIfAbsent
-
remove
-
remove
-
removeAll
public void removeAll() -
replace
-
addListener
-
removeListener
-
getLocalCache
protected com.atlassian.cache.ManagedCache getLocalCache()- Specified by:
getLocalCachein classManagedHybridCacheSupport
-