com.atlassian.confluence.cache
Class DeferredOperationsCache

java.lang.Object
  extended by com.atlassian.confluence.cache.CacheAdapter
      extended by 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 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 Summary
DeferredOperationsCache(com.atlassian.cache.Cache delegate)
          Construct a deferred operations cache wrapper
 
Method Summary
 Object get(Object key)
           
 Collection getKeys()
           
 boolean hasDeferredOperations()
           
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeferredOperationsCache

public DeferredOperationsCache(com.atlassian.cache.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 com.atlassian.cache.Cache
Overrides:
get in class CacheAdapter

getKeys

public Collection getKeys()
Specified by:
getKeys in interface com.atlassian.cache.Cache
Overrides:
getKeys in class CacheAdapter

put

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

remove

public void remove(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

hasDeferredOperations

public boolean hasDeferredOperations()

sync

public void sync()


Copyright © 2003-2012 Atlassian. All Rights Reserved.