Class AsyncInvalidationExoCache<K extends Serializable,V>
- java.lang.Object
-
- org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache<K,V>
-
- org.exoplatform.services.cache.invalidation.AsyncInvalidationExoCache<K,V>
-
- All Implemented Interfaces:
ExoCache<K,V>
public class AsyncInvalidationExoCache<K extends Serializable,V> extends ConcurrentFIFOExoCache<K,V>
This implementation ofExoCachewill behave exactly the same way asConcurrentFIFOExoCacheexcept in case of a cache change, indeed the modifications will be first applied locally then it will be invalidated over the cluster asynchronously to limit the performance impact on the local cluster node. This class can be used as a drop-in replacement forConcurrentFIFOExoCachein a cluster environment.
-
-
Constructor Summary
Constructors Constructor Description AsyncInvalidationExoCache(ExoCache<K,HashCode<V>> replicatedCache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ListenerContext<K,V>>getListeners()voidonClearCache()on clear cache eventvoidonExpire(K key, V obj)On expire entry eventvoidput(K key, V value)Performs a put in the cache.voidputLocal(K key, V value)Performs a put in the cache local mode (avoid replication).voidputMap(Map<? extends K,? extends V> objs)Performs a put of all the entries provided by the map argument.Vremove(Serializable key)Removes an entry from the cache.voidremoveLocal(Serializable key)Removes an entry from the cache local mode (avoid replication).-
Methods inherited from class org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache
addCacheListener, assertConsistent, clearCache, get, getCachedObjects, getCacheHit, getCacheMiss, getCacheSize, getLabel, getLiveTime, getLiveTimeMillis, getMaxSize, getName, isLogEnabled, onGet, onPut, onPutLocal, onRemove, removeCachedObjects, select, setLabel, setLiveTime, setLiveTimeMillis, setLogEnabled, setMaxSize, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.exoplatform.services.cache.ExoCache
putAsyncMap
-
-
-
-
Method Detail
-
put
public void put(K key, V value) throws NullPointerException
Description copied from interface:ExoCachePerforms a put in the cache.- Specified by:
putin interfaceExoCache<K extends Serializable,V>- Overrides:
putin classConcurrentFIFOExoCache<K extends Serializable,V>- Parameters:
key- the cache keyvalue- the cached value- Throws:
NullPointerException- if the key is null
-
putLocal
public void putLocal(K key, V value) throws NullPointerException
Description copied from interface:ExoCachePerforms a put in the cache local mode (avoid replication).- Specified by:
putLocalin interfaceExoCache<K extends Serializable,V>- Overrides:
putLocalin classConcurrentFIFOExoCache<K extends Serializable,V>- Parameters:
key- the cache keyvalue- the cached value- Throws:
NullPointerException- if the key is null
-
remove
public V remove(Serializable key) throws NullPointerException
Description copied from interface:ExoCacheRemoves an entry from the cache.- Specified by:
removein interfaceExoCache<K extends Serializable,V>- Overrides:
removein classConcurrentFIFOExoCache<K extends Serializable,V>- Parameters:
key- the cache key- Returns:
- the previously cached value or null if no entry existed or that entry value was evaluated to null
- Throws:
NullPointerException- if the provided key is null
-
removeLocal
public void removeLocal(Serializable key) throws NullPointerException
Description copied from interface:ExoCacheRemoves an entry from the cache local mode (avoid replication).- Parameters:
key- the cache key- Throws:
NullPointerException- if the provided key is null
-
putMap
public void putMap(Map<? extends K,? extends V> objs) throws NullPointerException, IllegalArgumentException
Description copied from interface:ExoCachePerforms a put of all the entries provided by the map argument.- Specified by:
putMapin interfaceExoCache<K extends Serializable,V>- Overrides:
putMapin classConcurrentFIFOExoCache<K extends Serializable,V>- Parameters:
objs- the objects to put- Throws:
NullPointerException- if the provided argument is nullIllegalArgumentException- if the provided map contains a null key
-
onExpire
public void onExpire(K key, V obj)
Description copied from interface:ExoCacheOn expire entry event- Specified by:
onExpirein interfaceExoCache<K extends Serializable,V>- Overrides:
onExpirein classConcurrentFIFOExoCache<K extends Serializable,V>- Parameters:
key- entry keyobj- value
-
onClearCache
public void onClearCache()
Description copied from interface:ExoCacheon clear cache event- Specified by:
onClearCachein interfaceExoCache<K extends Serializable,V>- Overrides:
onClearCachein classConcurrentFIFOExoCache<K extends Serializable,V>
-
getListeners
public List<ListenerContext<K,V>> getListeners()
- Overrides:
getListenersin classConcurrentFIFOExoCache<K extends Serializable,V>
-
-