Class 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
    • Method Detail

      • 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>
      • putIfAbsent

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

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

        public boolean remove​(@NotNull
                              K key,
                              @NotNull
                              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>
      • clear

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

        public boolean replace​(@NotNull
                               K key,
                               @NotNull
                               V oldValue,
                               @NotNull
                               V newValue)
        Specified by:
        replace in interface com.atlassian.cache.Cache<K,​V>
      • 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>
      • 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>