com.atlassian.confluence.cache
Class DeferredOperationsCache

java.lang.Object
  extended bycom.atlassian.confluence.cache.CacheAdapter
      extended bycom.atlassian.confluence.cache.DeferredOperationsCache
All Implemented Interfaces:
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(Cache delegate)
          Construct a deferred operations cache wrapper
 
Method Summary
 Object get(Object key)
           
 List getKeys()
           
 void put(Object key, Object value)
           
 void remove(Object key)
           
 void removeAll()
           
 void sync()
           
 
Methods inherited from class com.atlassian.confluence.cache.CacheAdapter
getDelegate, getName, getStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeferredOperationsCache

public DeferredOperationsCache(Cache delegate)
Construct a deferred operations cache wrapper

Parameters:
delegate - Cache to wrap
Method Detail

get

public Object get(Object key)
Specified by:
get in interface Cache
Overrides:
get in class CacheAdapter

getKeys

public List getKeys()
Specified by:
getKeys in interface Cache
Overrides:
getKeys in class CacheAdapter

put

public void put(Object key,
                Object value)
Specified by:
put in interface Cache
Overrides:
put in class CacheAdapter

remove

public void remove(Object key)
Specified by:
remove in interface Cache
Overrides:
remove in class CacheAdapter

removeAll

public void removeAll()
Specified by:
removeAll in interface Cache
Overrides:
removeAll in class CacheAdapter

sync

public void sync()


Confluence is developed by Atlassian.