public class DeferredOperationsCache<K,V> extends DefaultConfluenceCache<K,V>
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.Constructor and Description |
---|
DeferredOperationsCache(com.atlassian.cache.Cache<K,V> delegate)
Deprecated.
since 5.7
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the underlying object.
|
boolean |
containsKey(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(K key) |
V |
get(K key,
com.atlassian.cache.Supplier<? extends V> supplier) |
Collection<K> |
getKeys() |
String |
getName()
Return name of the deferred object
|
String |
getType()
Return human readable type of the object
|
boolean |
hasDeferredOperations()
Return true if the deferred has operations requiring
synchronisation.
|
void |
put(K key,
V value) |
void |
remove(K key) |
void |
removeAll() |
void |
sync()
Perform synchronization.
|
addListener, currentExpireAfterAccessMillis, currentExpireAfterWriteMillis, currentMaxEntries, getDelegate, getManagedDelegate, getName, getStatistics, isFlushable, isLocal, isReplicateAsynchronously, isReplicateViaCopy, isStatisticsEnabled, putIfAbsent, remove, removeListener, replace, setTimeToLive, updateExpireAfterAccess, updateExpireAfterWrite, updateMaxEntries
@Deprecated public DeferredOperationsCache(com.atlassian.cache.Cache<K,V> delegate)
delegate
- Cache to wrappublic static <K,V> DeferredOperationsCache<K,V> create(com.atlassian.cache.Cache<K,V> delegate, com.atlassian.cache.CacheLoader<K,V> loader)
@Nonnull public V get(@Nonnull K key, @Nonnull com.atlassian.cache.Supplier<? extends V> supplier)
public boolean containsKey(@Nonnull K key)
containsKey
in interface com.atlassian.cache.Cache<K,V>
containsKey
in class DefaultConfluenceCache<K,V>
@Nonnull public Collection<K> getKeys()
public void removeAll()
public boolean hasDeferredOperations()
public String getType()
public void clear()
clear
in interface com.atlassian.cache.ManagedCache
clear
in class DefaultConfluenceCache<K,V>
public void sync()
public String getName()
Copyright © 2003–2015 Atlassian. All rights reserved.