com.atlassian.confluence.cache
Class DeferredOperationsCache
java.lang.Object
com.atlassian.confluence.cache.CacheAdapter
com.atlassian.confluence.cache.DeferredOperationsCache
- All Implemented Interfaces:
- com.atlassian.cache.Cache
public class DeferredOperationsCache
- extends CacheAdapter
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 {@link #get(Object)} for
the same key. Once {@link #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 reponsibility to ensure
serialized access to this object.
|
Constructor Summary |
DeferredOperationsCache(com.atlassian.cache.Cache delegate)
Construct a deferred operations cache wrapper |
|
Method Summary |
java.lang.Object |
get(java.lang.Object key)
|
java.util.Collection |
getKeys()
|
void |
put(java.lang.Object key,
java.lang.Object value)
|
void |
remove(java.lang.Object key)
|
void |
removeAll()
|
void |
sync()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DeferredOperationsCache
public DeferredOperationsCache(com.atlassian.cache.Cache delegate)
- Construct a deferred operations cache wrapper
- Parameters:
delegate - Cache to wrap
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get in interface com.atlassian.cache.Cache- Overrides:
get in class CacheAdapter
getKeys
public java.util.Collection getKeys()
- Specified by:
getKeys in interface com.atlassian.cache.Cache- Overrides:
getKeys in class CacheAdapter
put
public void put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put in interface com.atlassian.cache.Cache- Overrides:
put in class CacheAdapter
remove
public void remove(java.lang.Object key)
- Specified by:
remove in interface com.atlassian.cache.Cache- Overrides:
remove in class CacheAdapter
removeAll
public void removeAll()
- Specified by:
removeAll in interface com.atlassian.cache.Cache- Overrides:
removeAll in class CacheAdapter
sync
public void sync()
Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.