Class HazelcastCache<K,V>

java.lang.Object
com.atlassian.cache.hazelcast.ManagedCacheSupport
com.atlassian.cache.hazelcast.HazelcastCache<K,V>
All Implemented Interfaces:
com.atlassian.cache.Cache<K,V>, com.atlassian.cache.ManagedCache, com.atlassian.cache.ReadThroughCache<K,V>

public class HazelcastCache<K,V> extends ManagedCacheSupport implements com.atlassian.cache.Cache<K,V>
Hazelcast implementation of the Cache and ManagedCache interfaces
Since:
2.4.0
  • Constructor Details

    • HazelcastCache

      public HazelcastCache(String name, com.hazelcast.map.IMap<K,com.atlassian.hazelcast.serialization.OsgiSafe<V>> map, com.atlassian.cache.CacheLoader<K,V> cacheLoader, com.atlassian.cache.hazelcast.CacheVersion cacheVersion, HazelcastCacheManager cacheManager)
  • Method Details

    • clear

      public void clear()
      Specified by:
      clear in interface com.atlassian.cache.ManagedCache
    • containsKey

      public boolean containsKey(@Nonnull K k)
      Specified by:
      containsKey in interface com.atlassian.cache.ReadThroughCache<K,V>
    • get

      public V get(@Nonnull K key)
      Specified by:
      get in interface com.atlassian.cache.ReadThroughCache<K,V>
    • get

      @Nonnull public V get(@Nonnull K key, @Nonnull com.atlassian.cache.Supplier<? extends V> valueSupplier)
      Specified by:
      get in interface com.atlassian.cache.ReadThroughCache<K,V>
    • getBulk

      @Nonnull public Map<K,V> getBulk(@Nonnull Set<K> keys, @Nonnull Function<Set<K>,Map<K,V>> valuesSupplier)
      Overrides the default implementation in Cache, optimised to use the bulk IMap.getAll(Set) and IMap.putAll(Map) methods.
      Specified by:
      getBulk in interface com.atlassian.cache.ReadThroughCache<K,V>
    • getKeys

      @Nonnull public Collection<K> getKeys()
      Specified by:
      getKeys in interface com.atlassian.cache.ReadThroughCache<K,V>
    • put

      public void put(@Nonnull K key, @Nonnull V value)
      Specified by:
      put in interface com.atlassian.cache.Cache<K,V>
    • putIfAbsent

      public V putIfAbsent(@Nonnull K key, @Nonnull V value)
      Specified by:
      putIfAbsent in interface com.atlassian.cache.Cache<K,V>
    • remove

      public void remove(@Nonnull K key)
      Specified by:
      remove in interface com.atlassian.cache.ReadThroughCache<K,V>
    • remove

      public boolean remove(@Nonnull K key, @Nonnull V value)
      Specified by:
      remove in interface com.atlassian.cache.ReadThroughCache<K,V>
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface com.atlassian.cache.ReadThroughCache<K,V>
    • replace

      public boolean replace(@Nonnull K key, @Nonnull V oldValue, @Nonnull V newValue)
      Specified by:
      replace in interface com.atlassian.cache.Cache<K,V>
    • addListener

      public void addListener(@Nonnull com.atlassian.cache.CacheEntryListener<K,V> listener, boolean includeValues)
      Specified by:
      addListener in interface com.atlassian.cache.Cache<K,V>
    • removeListener

      public void removeListener(@Nonnull com.atlassian.cache.CacheEntryListener<K,V> listener)
      Specified by:
      removeListener in interface com.atlassian.cache.Cache<K,V>
    • getHazelcastMapName

      @Nonnull protected String getHazelcastMapName()
      Specified by:
      getHazelcastMapName in class ManagedCacheSupport
    • getStatistics

      @Nonnull public SortedMap<com.atlassian.cache.CacheStatisticsKey,Supplier<Long>> getStatistics()
      Specified by:
      getStatistics in interface com.atlassian.cache.ManagedCache
      Overrides:
      getStatistics in class ManagedCacheSupport
    • isStatisticsEnabled

      public boolean isStatisticsEnabled()
      Specified by:
      isStatisticsEnabled in interface com.atlassian.cache.ManagedCache
      Overrides:
      isStatisticsEnabled in class ManagedCacheSupport