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 typeV
- 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-awareCache
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
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.cluster.atlassiancache.ManagedCacheSupport
cacheManager, name
-
-
Constructor Summary
Constructors Constructor Description GrpcBackedCache(@NotNull String name, @Nullable com.atlassian.cache.CacheLoader<K,V> cacheLoader, @NotNull GrpcBackedCacheManager cacheManager, @Nullable CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster, @NotNull XStreamManager xStreamManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(@NotNull com.atlassian.cache.CacheEntryListener<K,V> listener, boolean includeValues)
void
clear()
boolean
containsKey(K key)
V
get(K key)
V
get(K key, @NotNull com.atlassian.cache.Supplier<? extends V> valueSupplier)
@NotNull Map<K,V>
getBulk(@NotNull Set<K> keys, @NotNull Function<Set<K>,Map<K,V>> valuesSupplier)
void
getBulkFromRemote(@Nullable Map<String,String> entriesToPopulate)
@NotNull Collection<K>
getKeys()
com.google.common.cache.Cache<K,V>
getLocalStoreDelegate()
@NotNull SortedMap<com.atlassian.cache.CacheStatisticsKey,Supplier<Long>>
getStatistics()
void
processRemotePut(@Nullable String key, @Nullable String value)
void
processRemotePutIfAbsent(@Nullable String key, @Nullable String value)
void
processRemoteRemove(@Nullable String key)
void
processRemoteRemove(@Nullable String key, @Nullable String value)
void
processRemoteRemoveAll()
void
processRemoteReplace(@Nullable String key, @Nullable String oldValue, @Nullable String newValue)
void
put(K key, V value)
V
putIfAbsent(K key, V value)
void
remove(K key)
boolean
remove(K key, V value)
void
removeAll()
void
removeListener(@NotNull com.atlassian.cache.CacheEntryListener<K,V> listener)
boolean
replace(K key, V oldValue, V newValue)
-
Methods inherited from class com.atlassian.bamboo.cluster.atlassiancache.ManagedCacheSupport
currentExpireAfterAccessMillis, currentExpireAfterWriteMillis, currentMaxEntries, getCacheSettings, getName, isFlushable, isLocal, isReplicateAsynchronously, isReplicateViaCopy, isStatisticsEnabled, setStatistics, updateExpireAfterAccess, updateExpireAfterWrite, updateMaxEntries
-
-
-
-
Constructor Detail
-
GrpcBackedCache
public GrpcBackedCache(@NotNull @NotNull String name, @Nullable @Nullable com.atlassian.cache.CacheLoader<K,V> cacheLoader, @NotNull @NotNull GrpcBackedCacheManager cacheManager, @Nullable @Nullable CrossNodesRemoteBroadcaster crossNodesRemoteBroadcaster, @NotNull @NotNull XStreamManager xStreamManager)
-
-
Method Detail
-
containsKey
public boolean containsKey(@NotNull K key)
-
getKeys
@NotNull public @NotNull Collection<K> getKeys()
-
get
@NotNull public V get(@NotNull K key, @NotNull @NotNull com.atlassian.cache.Supplier<? extends V> valueSupplier)
-
processRemotePut
public void processRemotePut(@Nullable @Nullable String key, @Nullable @Nullable String value)
- Specified by:
processRemotePut
in interfaceCacheRemoteAccessor
-
processRemotePutIfAbsent
public void processRemotePutIfAbsent(@Nullable @Nullable String key, @Nullable @Nullable String value)
- Specified by:
processRemotePutIfAbsent
in interfaceCacheRemoteAccessor
-
remove
public void remove(@NotNull K key)
-
processRemoteRemove
public void processRemoteRemove(@Nullable @Nullable String key)
- Specified by:
processRemoteRemove
in interfaceCacheRemoteAccessor
-
processRemoteRemove
public void processRemoteRemove(@Nullable @Nullable String key, @Nullable @Nullable String value)
- Specified by:
processRemoteRemove
in interfaceCacheRemoteAccessor
-
removeAll
public void removeAll()
-
clear
public void clear()
- Specified by:
clear
in interfacecom.atlassian.cache.ManagedCache
-
processRemoteRemoveAll
public void processRemoteRemoveAll()
- Specified by:
processRemoteRemoveAll
in interfaceCacheRemoteAccessor
-
processRemoteReplace
public void processRemoteReplace(@Nullable @Nullable String key, @Nullable @Nullable String oldValue, @Nullable @Nullable String newValue)
- Specified by:
processRemoteReplace
in interfaceCacheRemoteAccessor
-
getBulk
@NotNull public @NotNull Map<K,V> getBulk(@NotNull @NotNull Set<K> keys, @NotNull @NotNull Function<Set<K>,Map<K,V>> valuesSupplier)
-
getBulkFromRemote
public void getBulkFromRemote(@Nullable @Nullable Map<String,String> entriesToPopulate)
- Specified by:
getBulkFromRemote
in interfaceCacheRemoteAccessor
-
getStatistics
@NotNull public @NotNull SortedMap<com.atlassian.cache.CacheStatisticsKey,Supplier<Long>> getStatistics()
- Specified by:
getStatistics
in interfacecom.atlassian.cache.ManagedCache
- Overrides:
getStatistics
in classManagedCacheSupport
-
addListener
public void addListener(@NotNull @NotNull com.atlassian.cache.CacheEntryListener<K,V> listener, boolean includeValues)
-
-