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 ofCache
that 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 void
clear()
boolean
containsKey(@NonNull K key)
static <K,V>
DeferredOperationsCache<K,V>create(com.atlassian.cache.Cache<K,V> delegate, com.atlassian.cache.CacheLoader<K,V> loader)
V
get(@NonNull K key)
@NonNull V
get(@NonNull K key, @NonNull com.atlassian.cache.Supplier<? extends V> supplier)
@NonNull Collection<K>
getKeys()
String
getName()
Return name of the deferred objectString
getType()
boolean
hasDeferredOperations()
void
put(@NonNull K key, @NonNull V value)
void
remove(@NonNull K key)
void
removeAll()
void
sync()
-
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:
containsKey
in interfacecom.atlassian.cache.Cache<K,V>
- Overrides:
containsKey
in 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:
clear
in interfacecom.atlassian.cache.ManagedCache
- Overrides:
clear
in classDefaultConfluenceCache<K,V>
-
sync
public void sync()
-
getName
public abstract String getName()
Return name of the deferred object- Returns:
- name of the deferred object
-
-