Package com.atlassian.confluence.cache
Class ConfluenceMonitoringCache<K,V>
- java.lang.Object
-
- com.atlassian.confluence.cache.ConfluenceMonitoringCache<K,V>
-
- All Implemented Interfaces:
com.atlassian.cache.Cache<K,V>,com.atlassian.cache.ManagedCache,ConfluenceCache<K,V>
@Internal public class ConfluenceMonitoringCache<K,V> extends Object implements ConfluenceCache<K,V>
A wrapper for monitoring the performance of Confluence caches. The performance is monitored using the suppliedConfluenceMonitoringinstance.- Since:
- 5.6
-
-
Constructor Summary
Constructors Constructor Description ConfluenceMonitoringCache(ConfluenceCache<K,V> cache, ConfluenceMonitoring confluenceMonitoring)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(@NonNull com.atlassian.cache.CacheEntryListener<K,V> kvCacheEntryListener, boolean b)voidclear()booleancontainsKey(@NonNull K k)protected SplitcreateLockSplit()protected SplitcreateReadSplit()protected SplitcreateSplit(String operation)protected SplitcreateUnlockSplit()protected SplitcreateWriteSplit()@Nullable LongcurrentExpireAfterAccessMillis()@Nullable LongcurrentExpireAfterWriteMillis()@Nullable IntegercurrentMaxEntries()Vget(@NonNull K key)@NonNull Vget(@NonNull K k, @NonNull com.atlassian.cache.Supplier<? extends V> supplier)@Nullable com.atlassian.instrumentation.caches.CacheCollectorgetCacheCollector()@NonNull Collection<K>getKeys()@NonNull StringgetName()@NonNull SortedMap<com.atlassian.cache.CacheStatisticsKey,Supplier<Long>>getStatistics()booleanisFlushable()booleanisLocal()booleanisReplicateAsynchronously()booleanisReplicateViaCopy()booleanisStatisticsEnabled()voidput(@NonNull K key, @NonNull V value)VputIfAbsent(@NonNull K key, @NonNull V value)voidremove(@NonNull K key)booleanremove(@NonNull K key, @NonNull V value)voidremoveAll()voidremoveListener(@NonNull com.atlassian.cache.CacheEntryListener<K,V> kvCacheEntryListener)booleanreplace(@NonNull K key, @NonNull V oldValue, @NonNull V newValue)voidsetStatistics(boolean b)booleanupdateExpireAfterAccess(long expireAfter, @NonNull TimeUnit timeUnit)booleanupdateExpireAfterWrite(long expireAfter, @NonNull TimeUnit timeUnit)booleanupdateMaxEntries(int newValue)
-
-
-
Constructor Detail
-
ConfluenceMonitoringCache
public ConfluenceMonitoringCache(ConfluenceCache<K,V> cache, ConfluenceMonitoring confluenceMonitoring)
Constructs a new instance.- Parameters:
cache- the (Cache) interface to the cache to be monitoredconfluenceMonitoring- theConfluenceMonitoringinstance to use for monitoring
-
-
Method Detail
-
get
public @NonNull V get(@NonNull K k, @NonNull com.atlassian.cache.Supplier<? extends V> supplier)
-
containsKey
public boolean containsKey(@NonNull K k)
-
getKeys
public @NonNull Collection<K> getKeys()
-
remove
public void remove(@NonNull K key)
-
removeAll
public void removeAll()
-
addListener
public void addListener(@NonNull com.atlassian.cache.CacheEntryListener<K,V> kvCacheEntryListener, boolean b)
-
removeListener
public void removeListener(@NonNull com.atlassian.cache.CacheEntryListener<K,V> kvCacheEntryListener)
-
clear
public void clear()
- Specified by:
clearin interfacecom.atlassian.cache.ManagedCache
-
getName
public @NonNull String getName()
-
isFlushable
public boolean isFlushable()
- Specified by:
isFlushablein interfacecom.atlassian.cache.ManagedCache
-
currentMaxEntries
public @Nullable Integer currentMaxEntries()
- Specified by:
currentMaxEntriesin interfacecom.atlassian.cache.ManagedCache
-
updateMaxEntries
public boolean updateMaxEntries(int newValue)
- Specified by:
updateMaxEntriesin interfacecom.atlassian.cache.ManagedCache
-
currentExpireAfterAccessMillis
public @Nullable Long currentExpireAfterAccessMillis()
- Specified by:
currentExpireAfterAccessMillisin interfacecom.atlassian.cache.ManagedCache
-
updateExpireAfterAccess
public boolean updateExpireAfterAccess(long expireAfter, @NonNull TimeUnit timeUnit)- Specified by:
updateExpireAfterAccessin interfacecom.atlassian.cache.ManagedCache
-
currentExpireAfterWriteMillis
public @Nullable Long currentExpireAfterWriteMillis()
- Specified by:
currentExpireAfterWriteMillisin interfacecom.atlassian.cache.ManagedCache
-
updateExpireAfterWrite
public boolean updateExpireAfterWrite(long expireAfter, @NonNull TimeUnit timeUnit)- Specified by:
updateExpireAfterWritein interfacecom.atlassian.cache.ManagedCache
-
isLocal
public boolean isLocal()
- Specified by:
isLocalin interfacecom.atlassian.cache.ManagedCache
-
isReplicateAsynchronously
public boolean isReplicateAsynchronously()
- Specified by:
isReplicateAsynchronouslyin interfacecom.atlassian.cache.ManagedCache
-
isReplicateViaCopy
public boolean isReplicateViaCopy()
- Specified by:
isReplicateViaCopyin interfacecom.atlassian.cache.ManagedCache
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
- Specified by:
isStatisticsEnabledin interfacecom.atlassian.cache.ManagedCache
-
setStatistics
public void setStatistics(boolean b)
- Specified by:
setStatisticsin interfacecom.atlassian.cache.ManagedCache
-
getStatistics
public @NonNull SortedMap<com.atlassian.cache.CacheStatisticsKey,Supplier<Long>> getStatistics()
- Specified by:
getStatisticsin interfacecom.atlassian.cache.ManagedCache
-
getCacheCollector
public @Nullable com.atlassian.instrumentation.caches.CacheCollector getCacheCollector()
- Specified by:
getCacheCollectorin interfacecom.atlassian.cache.ManagedCache
-
createReadSplit
protected Split createReadSplit()
-
createWriteSplit
protected Split createWriteSplit()
-
createLockSplit
protected Split createLockSplit()
-
createUnlockSplit
protected Split createUnlockSplit()
-
-