Class DefaultConfluenceCache<K,​V>

  • All Implemented Interfaces:
    com.atlassian.cache.Cache<K,​V>, com.atlassian.cache.ManagedCache, ConfluenceCache<K,​V>
    Direct Known Subclasses:
    DeferredOperationsCache

    @Internal
    public class DefaultConfluenceCache<K,​V>
    extends Object
    implements ConfluenceCache<K,​V>
    Default implementation of the ConfluenceCache interface. It federates the ManagedCache and Cache interfaces, for ease of implementation within confluence.
    • Constructor Detail

      • DefaultConfluenceCache

        public DefaultConfluenceCache​(com.atlassian.cache.Cache<K,​V> delegate)
    • Method Detail

      • containsKey

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

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

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

        public @NonNull V get​(@NonNull K key,
                              @NonNull com.atlassian.cache.Supplier<? extends V> supplier)
        Specified by:
        get in interface com.atlassian.cache.Cache<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 @Nullable 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.Cache<K,​V>
      • remove

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

        public void removeAll()
        Specified by:
        removeAll in interface com.atlassian.cache.Cache<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 required)
        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>
      • clear

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

        public @NonNull String getName()
        Specified by:
        getName in interface com.atlassian.cache.Cache<K,​V>
        Specified by:
        getName in interface com.atlassian.cache.ManagedCache
      • isFlushable

        public boolean isFlushable()
        Specified by:
        isFlushable in interface com.atlassian.cache.ManagedCache
      • currentMaxEntries

        public @Nullable Integer currentMaxEntries()
        Specified by:
        currentMaxEntries in interface com.atlassian.cache.ManagedCache
      • updateMaxEntries

        public boolean updateMaxEntries​(int newValue)
        Specified by:
        updateMaxEntries in interface com.atlassian.cache.ManagedCache
      • currentExpireAfterAccessMillis

        public @Nullable Long currentExpireAfterAccessMillis()
        Specified by:
        currentExpireAfterAccessMillis in interface com.atlassian.cache.ManagedCache
      • updateExpireAfterAccess

        public boolean updateExpireAfterAccess​(long expireAfter,
                                               @NonNull TimeUnit timeUnit)
        Specified by:
        updateExpireAfterAccess in interface com.atlassian.cache.ManagedCache
      • currentExpireAfterWriteMillis

        public @Nullable Long currentExpireAfterWriteMillis()
        Specified by:
        currentExpireAfterWriteMillis in interface com.atlassian.cache.ManagedCache
      • updateExpireAfterWrite

        public boolean updateExpireAfterWrite​(long expireAfter,
                                              @NonNull TimeUnit timeUnit)
        Specified by:
        updateExpireAfterWrite in interface com.atlassian.cache.ManagedCache
      • isLocal

        public boolean isLocal()
        Specified by:
        isLocal in interface com.atlassian.cache.ManagedCache
      • isReplicateAsynchronously

        public boolean isReplicateAsynchronously()
        Specified by:
        isReplicateAsynchronously in interface com.atlassian.cache.ManagedCache
      • isReplicateViaCopy

        public boolean isReplicateViaCopy()
        Specified by:
        isReplicateViaCopy in interface com.atlassian.cache.ManagedCache
      • isStatisticsEnabled

        public boolean isStatisticsEnabled()
        Specified by:
        isStatisticsEnabled in interface com.atlassian.cache.ManagedCache
      • setStatistics

        public void setStatistics​(boolean b)
        Specified by:
        setStatistics in interface com.atlassian.cache.ManagedCache
      • getStatistics

        public @NonNull SortedMap<com.atlassian.cache.CacheStatisticsKey,​Supplier<Long>> getStatistics()
        Specified by:
        getStatistics in interface com.atlassian.cache.ManagedCache
      • getCacheCollector

        public @Nullable com.atlassian.instrumentation.caches.CacheCollector getCacheCollector()
        Specified by:
        getCacheCollector in interface com.atlassian.cache.ManagedCache
      • getDelegate

        protected com.atlassian.cache.Cache<K,​V> getDelegate()
      • getManagedDelegate

        protected com.atlassian.cache.ManagedCache getManagedDelegate()