com.atlassian.confluence.cache
Class DefaultConfluenceCache<K,V>

java.lang.Object
  extended by com.atlassian.confluence.cache.DefaultConfluenceCache<K,V>
All Implemented Interfaces:
com.atlassian.cache.Cache<K,V>, com.atlassian.cache.ManagedCache, ConfigurableCache<K,V>, ConfluenceCache<K,V>
Direct Known Subclasses:
DeferredOperationsCache, HazelcastLockingCache

@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 Summary
DefaultConfluenceCache(com.atlassian.cache.Cache<K,V> delegate)
           
 
Method Summary
 void addListener(com.atlassian.cache.CacheEntryListener<K,V> listener, boolean required)
           
 void clear()
           
 boolean containsKey(K key)
           
 Long currentExpireAfterAccessMillis()
           
 Long currentExpireAfterWriteMillis()
           
 Integer currentMaxEntries()
           
 V get(K key)
           
 V get(K key, com.atlassian.cache.Supplier<? extends V> supplier)
           
protected  com.atlassian.cache.Cache<K,V> getDelegate()
           
 Collection<K> getKeys()
           
protected  com.atlassian.cache.ManagedCache getManagedDelegate()
           
 String getName()
           
 SortedMap<com.atlassian.cache.CacheStatisticsKey,com.atlassian.util.concurrent.Supplier<Long>> getStatistics()
           
 boolean isFlushable()
           
 boolean isLocal()
           
 boolean isReplicateAsynchronously()
           
 boolean isReplicateViaCopy()
           
 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(com.atlassian.cache.CacheEntryListener<K,V> listener)
           
 boolean replace(K key, V oldValue, V newValue)
           
 void setTimeToLive(long timeToLive, TimeUnit timeUnit)
          Update the time to live.
 boolean updateExpireAfterAccess(long expireAfter, TimeUnit timeUnit)
           
 boolean updateExpireAfterWrite(long expireAfter, TimeUnit timeUnit)
           
 boolean updateMaxEntries(int newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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

get

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

get

@Nonnull
public 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

@Nullable
public 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

@Nonnull
public 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

@Nullable
public 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

@Nullable
public 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

@Nullable
public 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

getStatistics

@Nonnull
public SortedMap<com.atlassian.cache.CacheStatisticsKey,com.atlassian.util.concurrent.Supplier<Long>> getStatistics()
Specified by:
getStatistics in interface com.atlassian.cache.ManagedCache

setTimeToLive

public void setTimeToLive(long timeToLive,
                          TimeUnit timeUnit)
Description copied from interface: ConfigurableCache
Update the time to live. Please note, some implementations cannot store time values smaller than TimeUnit.SECONDS.

Specified by:
setTimeToLive in interface ConfigurableCache<K,V>
Parameters:
timeToLive - value
timeUnit - unit of time

getDelegate

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

getManagedDelegate

protected com.atlassian.cache.ManagedCache getManagedDelegate()


Copyright © 2003–2015 Atlassian. All rights reserved.