Class GrpcBackedCache<K,V>

java.lang.Object
com.atlassian.bamboo.cluster.atlassiancache.ManagedCacheSupport
com.atlassian.bamboo.cluster.atlassiancache.GrpcBackedCache<K,V>
Type Parameters:
K - key type
V - value type
All Implemented Interfaces:
CacheRemoteAccessor, com.atlassian.cache.Cache<K,V>, com.atlassian.cache.ManagedCache, com.atlassian.cache.ReadThroughCache<K,V>

public class GrpcBackedCache<K,V> extends ManagedCacheSupport implements com.atlassian.cache.Cache<K,V>, CacheRemoteAccessor
A cluster-aware Cache backed by a gRPC transport that transforms keys/values using XStream serialization/deserialization. There is no support for modifying the cache settings after the cache has been created.
Since:
9.5
  • Constructor Details

  • Method Details

    • containsKey

      public boolean containsKey(@NotNull K key)
      Specified by:
      containsKey in interface com.atlassian.cache.ReadThroughCache<K,V>
    • getKeys

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

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

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

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

      public void processRemotePut(@Nullable @Nullable String key, @Nullable @Nullable String value)
      Specified by:
      processRemotePut in interface CacheRemoteAccessor
    • putIfAbsent

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

      public void processRemotePutIfAbsent(@Nullable @Nullable String key, @Nullable @Nullable String value)
      Specified by:
      processRemotePutIfAbsent in interface CacheRemoteAccessor
    • remove

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

      public void processRemoteRemove(@Nullable @Nullable String key)
      Specified by:
      processRemoteRemove in interface CacheRemoteAccessor
    • remove

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

      public void processRemoteRemove(@Nullable @Nullable String key, @Nullable @Nullable String value)
      Specified by:
      processRemoteRemove in interface CacheRemoteAccessor
    • removeAll

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

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

      public void processRemoteRemoveAll()
      Specified by:
      processRemoteRemoveAll in interface CacheRemoteAccessor
    • replace

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

      public void processRemoteReplace(@Nullable @Nullable String key, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue)
      Specified by:
      processRemoteReplace in interface CacheRemoteAccessor
    • getBulk

      @NotNull public @NotNull Map<K,V> getBulk(@NotNull @NotNull Set<K> keys, @NotNull @NotNull Function<Set<K>,Map<K,V>> valuesSupplier)
      Specified by:
      getBulk in interface com.atlassian.cache.ReadThroughCache<K,V>
    • getBulkFromRemote

      public void getBulkFromRemote(@Nullable @Nullable Map<String,String> entriesToPopulate)
      Specified by:
      getBulkFromRemote in interface CacheRemoteAccessor
    • getStatistics

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

      @NotNull public com.google.common.cache.Cache<K,V> getLocalStoreDelegate()
    • addListener

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

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