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>
An implementation of
Cache
that records changes to a delegate cache, only actually
performing them when sync()
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 to get(Object)
for the same key. Once sync()
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
Modifier and TypeMethodDescriptionvoid
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) @NonNull V
@NonNull Collection
<K> getKeys()
getName()
Return name of the deferred objectgetType()
boolean
void
void
void
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.cache.Cache
getBulk
-
Method Details
-
create
public static <K,V> DeferredOperationsCache<K,V> create(com.atlassian.cache.Cache<K, V> delegate, com.atlassian.cache.CacheLoader<K, V> loader) -
get
-
get
-
containsKey
- Specified by:
containsKey
in interfacecom.atlassian.cache.Cache<K,
V> - Overrides:
containsKey
in classDefaultConfluenceCache<K,
V>
-
getKeys
-
put
-
remove
-
removeAll
public void removeAll() -
hasDeferredOperations
public boolean hasDeferredOperations() -
getType
-
clear
public void clear()- Specified by:
clear
in interfacecom.atlassian.cache.ManagedCache
- Overrides:
clear
in classDefaultConfluenceCache<K,
V>
-
sync
public void sync() -
getName
String getName()Return name of the deferred object- Returns:
- name of the deferred object
-