Package com.atlassian.confluence.cache
Class DeferredOperationsCache<K,V>
- java.lang.Object
-
- com.atlassian.confluence.cache.DefaultConfluenceCache<K,V>
-
- com.atlassian.confluence.cache.DeferredOperationsCache<K,V>
-
- All Implemented Interfaces:
com.atlassian.cache.Cache<K,V>,com.atlassian.cache.ManagedCache,ConfluenceCache<K,V>
public class DeferredOperationsCache<K,V> extends DefaultConfluenceCache<K,V>
An implementation ofCachethat records changes to a delegate cache, only actually performing them whensync()is called. Deferred operations are still visible to the client, the actions are just not taken on the delegate cache.For example, calling
put(Object, Object)will not update the delegate cache, but the value will still be recorded for subsequent calls toget(Object)for the same key. Oncesync()is called, the new value will be inserted in the delegate cache.Objects of this class are NOT thread-safe. It is the client's responsibility to ensure serialized access to this object.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(@NonNull K key)static <K,V>
DeferredOperationsCache<K,V>create(com.atlassian.cache.Cache<K,V> delegate, com.atlassian.cache.CacheLoader<K,V> loader)Vget(@NonNull K key)@NonNull Vget(@NonNull K key, @NonNull com.atlassian.cache.Supplier<? extends V> supplier)@NonNull Collection<K>getKeys()StringgetName()Return name of the deferred objectStringgetType()booleanhasDeferredOperations()voidput(@NonNull K key, @NonNull V value)voidremove(@NonNull K key)voidremoveAll()voidsync()-
Methods inherited from class com.atlassian.confluence.cache.DefaultConfluenceCache
addListener, currentExpireAfterAccessMillis, currentExpireAfterWriteMillis, currentMaxEntries, getCacheCollector, getDelegate, getManagedDelegate, getName, getStatistics, isFlushable, isLocal, isReplicateAsynchronously, isReplicateViaCopy, isStatisticsEnabled, putIfAbsent, remove, removeListener, replace, setStatistics, updateExpireAfterAccess, updateExpireAfterWrite, updateMaxEntries
-
-
-
-
Method Detail
-
create
public static <K,V> DeferredOperationsCache<K,V> create(com.atlassian.cache.Cache<K,V> delegate, com.atlassian.cache.CacheLoader<K,V> loader)
-
get
public @NonNull V get(@NonNull K key, @NonNull com.atlassian.cache.Supplier<? extends V> supplier)
-
containsKey
public boolean containsKey(@NonNull K key)
- Specified by:
containsKeyin interfacecom.atlassian.cache.Cache<K,V>- Overrides:
containsKeyin classDefaultConfluenceCache<K,V>
-
getKeys
public @NonNull Collection<K> getKeys()
-
remove
public void remove(@NonNull K key)
-
removeAll
public void removeAll()
-
hasDeferredOperations
public boolean hasDeferredOperations()
-
getType
public String getType()
-
clear
public void clear()
- Specified by:
clearin interfacecom.atlassian.cache.ManagedCache- Overrides:
clearin classDefaultConfluenceCache<K,V>
-
sync
public void sync()
-
getName
public abstract String getName()
Return name of the deferred object- Returns:
- name of the deferred object
-
-