Class SimpleReplicatedExoCache<K extends Serializable,V extends Serializable>
- java.lang.Object
-
- org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache<K,V>
-
- org.exoplatform.services.cache.concurrent.SimpleReplicatedExoCache<K,V>
-
- All Implemented Interfaces:
ExoCache<K,V>
public class SimpleReplicatedExoCache<K extends Serializable,V extends Serializable> extends ConcurrentFIFOExoCache<K,V>
This implementation of
ExoCachewill behave exactly the same way asConcurrentFIFOExoCacheexcept in case of a cache change, indeed the modifications will be first applied locally then it will be replicated over the cluster asynchronously to limit the performance impact on the local cluster node.This class can be used as a drop-in replacement for
This limitation is due to the fact that the mechanism used for the replication has not been designed to support heavy load so it must be used with a lot of caution.ConcurrentFIFOExoCachein a cluster environment as long as we know that modifications like remove, clearCache, removeCachedObjects, put or putMap happen rarely. In other words, it should be used for caches that rarely change.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
-
Constructor Summary
Constructors Constructor Description SimpleReplicatedExoCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Clears the cache.protected voidfinalize()voidput(K name, V obj)Performs a put in the cache.voidputMap(Map<? extends K,? extends V> objs)Performs a put of all the entries provided by the map argument.Vremove(Serializable name)Removes an entry from the cache.voidsetName(String s)Sets the cache name.-
Methods inherited from class org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache
addCacheListener, assertConsistent, get, getCachedObjects, getCacheHit, getCacheMiss, getCacheSize, getLabel, getListeners, getLiveTime, getLiveTimeMillis, getMaxSize, getName, isLogEnabled, onClearCache, onExpire, onGet, onPut, onPutLocal, onRemove, putLocal, removeCachedObjects, select, setLabel, setLiveTime, setLiveTimeMillis, setLogEnabled, setMaxSize
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.exoplatform.services.cache.ExoCache
putAsyncMap, removeLocal
-
-
-
-
Method Detail
-
setName
public void setName(String s)
Description copied from interface:ExoCacheSets the cache name.- Specified by:
setNamein interfaceExoCache<K extends Serializable,V extends Serializable>- Overrides:
setNamein classConcurrentFIFOExoCache<K extends Serializable,V extends Serializable>- Parameters:
s- the cache name
-
remove
public V remove(Serializable name)
Description copied from interface:ExoCacheRemoves an entry from the cache.- Specified by:
removein interfaceExoCache<K extends Serializable,V extends Serializable>- Overrides:
removein classConcurrentFIFOExoCache<K extends Serializable,V extends Serializable>- Parameters:
name- the cache key- Returns:
- the previously cached value or null if no entry existed or that entry value was evaluated to null
-
clearCache
public void clearCache()
Description copied from interface:ExoCacheClears the cache.- Specified by:
clearCachein interfaceExoCache<K extends Serializable,V extends Serializable>- Overrides:
clearCachein classConcurrentFIFOExoCache<K extends Serializable,V extends Serializable>
-
put
public void put(K name, V obj)
Description copied from interface:ExoCachePerforms a put in the cache.- Specified by:
putin interfaceExoCache<K extends Serializable,V extends Serializable>- Overrides:
putin classConcurrentFIFOExoCache<K extends Serializable,V extends Serializable>- Parameters:
name- the cache keyobj- the cached value
-
putMap
public void putMap(Map<? extends K,? extends V> objs)
Description copied from interface:ExoCachePerforms a put of all the entries provided by the map argument.- Specified by:
putMapin interfaceExoCache<K extends Serializable,V extends Serializable>- Overrides:
putMapin classConcurrentFIFOExoCache<K extends Serializable,V extends Serializable>- Parameters:
objs- the objects to put
-
-