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 ExoCache will behave exactly the same way as ConcurrentFIFOExoCache
except 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 ConcurrentFIFOExoCache in 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cache.protected voidfinalize()voidPerforms a put in the cache.voidPerforms a put of all the entries provided by the map argument.remove(Serializable name) Removes an entry from the cache.voidSets 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, setMaxSizeMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.exoplatform.services.cache.ExoCache
putAsyncMap, removeLocal
-
Constructor Details
-
SimpleReplicatedExoCache
public SimpleReplicatedExoCache()
-
-
Method Details
-
setName
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
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
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
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
-
finalize
-