public class InvalidationExoCache<K extends Serializable,V> extends Object implements ExoCache<K,V>, CacheListener<K,HashCode<V>>
| Constructor and Description |
|---|
InvalidationExoCache(ExoCache<K,V> delegate) |
InvalidationExoCache(ExoCache<K,V> delegate,
int concurrencyLevel) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheListener(CacheListener<? super K,? super V> listener)
Add a listener.
|
void |
clearCache()
Clears the cache.
|
V |
get(Serializable name)
Performs a lookup operation.
|
List<? extends V> |
getCachedObjects()
Returns a list of cached object that are considered as valid when the method is called.
|
int |
getCacheHit()
Returns the number of time the cache was queried and a valid entry was returned.
|
int |
getCacheMiss()
Returns the number of time the cache was queried and no entry was returned.
|
int |
getCacheSize()
Returns the number of entries in the cache.
|
String |
getLabel()
Returns the cache label
|
long |
getLiveTime()
Returns the maximum life time of an entry in the cache.
|
int |
getMaxSize()
Returns the maximum capacity of the cache.
|
String |
getName()
Returns the cache name
|
boolean |
isLogEnabled() |
void |
onClearCache(CacheListenerContext context)
The cache is globally cleared.
|
void |
onExpire(CacheListenerContext context,
K key,
HashCode<V> obj)
An entry is expired from the cache.
|
void |
onGet(CacheListenerContext context,
K key,
HashCode<V> obj)
An entry is retrieved from the cache.
|
void |
onPut(CacheListenerContext context,
K key,
HashCode<V> obj)
An entry is inserted in the cache.
|
void |
onRemove(CacheListenerContext context,
K key,
HashCode<V> obj)
An entry is removed from the cache.
|
void |
put(K key,
V value)
Performs a put in the cache.
|
void |
putLocal(K key,
V value)
Performs a put in the cache local mode (avoid replication).
|
void |
putMap(Map<? extends K,? extends V> objs)
Performs a put of all the entries provided by the map argument.
|
V |
remove(Serializable key)
Removes an entry from the cache.
|
List<? extends V> |
removeCachedObjects()
Clears the cache and returns the list of cached object that are considered as valid when the method is called.
|
void |
removeLocal(Serializable key)
Removes an entry from the cache local mode (avoid replication).
|
void |
select(CachedObjectSelector<? super K,? super V> selector)
Selects a subset of the cache.
|
void |
setLabel(String s)
Sets the cache label
|
void |
setLiveTime(long period)
Sets the maximum life time of an entry in the cache.
|
void |
setLogEnabled(boolean b) |
void |
setMaxSize(int max)
Sets the maximum capacity of the cache.
|
void |
setName(String name)
Sets the cache name.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonClearCache, onExpire, onGet, onPut, onPutLocal, onRemove, putAsyncMaponPutLocalpublic InvalidationExoCache(ExoCache<K,V> delegate)
delegate - the underneath eXo cache instance, we assume that the eXo cache
implementation behind is fully functional.public InvalidationExoCache(ExoCache<K,V> delegate, int concurrencyLevel)
delegate - the underneath eXo cache instance, we assume that the eXo cache
implementation behind is fully functional.concurrencyLevel - the estimated number of concurrently
updating threads. The implementation performs internal sizing
to try to accommodate this many threads.public String getName()
ExoCachegetName in interface ExoCache<K extends Serializable,V>ExoCache.getName()public void setName(String name)
ExoCachesetName in interface ExoCache<K extends Serializable,V>name - the cache nameExoCache.setName(java.lang.String)public String getLabel()
ExoCachegetLabel in interface ExoCache<K extends Serializable,V>ExoCache.getLabel()public void setLabel(String s)
ExoCachesetLabel in interface ExoCache<K extends Serializable,V>s - the cache labelExoCache.setLabel(java.lang.String)public V get(Serializable name)
ExoCacheget in interface ExoCache<K extends Serializable,V>name - the cache keyExoCache.get(java.io.Serializable)public V remove(Serializable key) throws NullPointerException
ExoCacheremove in interface ExoCache<K extends Serializable,V>key - the cache keyNullPointerException - if the provided key is nullExoCache.remove(java.io.Serializable)public void removeLocal(Serializable key) throws NullPointerException
ExoCacheremoveLocal in interface ExoCache<K extends Serializable,V>key - the cache keyNullPointerException - if the provided key is nullExoCache.remove(java.io.Serializable)public void put(K key, V value) throws NullPointerException
ExoCacheput in interface ExoCache<K extends Serializable,V>key - the cache keyvalue - the cached valueNullPointerException - if the key is nullExoCache.put(java.io.Serializable, java.lang.Object)public void putLocal(K key, V value) throws NullPointerException
ExoCacheputLocal in interface ExoCache<K extends Serializable,V>key - the cache keyvalue - the cached valueNullPointerException - if the key is nullpublic void putMap(Map<? extends K,? extends V> objs) throws IllegalArgumentException
ExoCacheputMap in interface ExoCache<K extends Serializable,V>objs - the objects to putIllegalArgumentException - if the provided map contains a null keyExoCache.putMap(java.util.Map)public void clearCache()
ExoCacheclearCache in interface ExoCache<K extends Serializable,V>ExoCache.clearCache()public void select(CachedObjectSelector<? super K,? super V> selector) throws Exception
ExoCacheselect in interface ExoCache<K extends Serializable,V>selector - the selectorException - any exceptionExoCache.select(org.exoplatform.services.cache.CachedObjectSelector)public int getCacheSize()
ExoCachegetCacheSize in interface ExoCache<K extends Serializable,V>ExoCache.getCacheSize()public int getMaxSize()
ExoCachegetMaxSize in interface ExoCache<K extends Serializable,V>ExoCache.getMaxSize()public void setMaxSize(int max)
ExoCachesetMaxSize in interface ExoCache<K extends Serializable,V>max - the maximum capacityExoCache.setMaxSize(int)public long getLiveTime()
ExoCachegetLiveTime in interface ExoCache<K extends Serializable,V>ExoCache.getLiveTime()public void setLiveTime(long period)
ExoCachesetLiveTime in interface ExoCache<K extends Serializable,V>period - the live timeExoCache.setLiveTime(long)public int getCacheHit()
ExoCachegetCacheHit in interface ExoCache<K extends Serializable,V>ExoCache.getCacheHit()public int getCacheMiss()
ExoCachegetCacheMiss in interface ExoCache<K extends Serializable,V>ExoCache.getCacheMiss()public List<? extends V> getCachedObjects()
ExoCachegetCachedObjects in interface ExoCache<K extends Serializable,V>ExoCache.getCachedObjects()public List<? extends V> removeCachedObjects()
ExoCacheremoveCachedObjects in interface ExoCache<K extends Serializable,V>ExoCache.removeCachedObjects()public void addCacheListener(CacheListener<? super K,? super V> listener) throws IllegalArgumentException
ExoCacheaddCacheListener in interface ExoCache<K extends Serializable,V>listener - the listener to addIllegalArgumentExceptionExoCache.addCacheListener(org.exoplatform.services.cache.CacheListener)public boolean isLogEnabled()
isLogEnabled in interface ExoCache<K extends Serializable,V>ExoCache.isLogEnabled()public void setLogEnabled(boolean b)
setLogEnabled in interface ExoCache<K extends Serializable,V>ExoCache.setLogEnabled(boolean)public void onExpire(CacheListenerContext context, K key, HashCode<V> obj) throws Exception
onExpire in interface CacheListener<K extends Serializable,HashCode<V>>context - the listener contextkey - the entry keyobj - the entry valueException - any exceptionpublic void onRemove(CacheListenerContext context, K key, HashCode<V> obj) throws Exception
onRemove in interface CacheListener<K extends Serializable,HashCode<V>>context - the listener contextkey - the entry keyobj - the entry valueException - any exceptionpublic void onPut(CacheListenerContext context, K key, HashCode<V> obj) throws Exception
onPut in interface CacheListener<K extends Serializable,HashCode<V>>context - the listener contextkey - the entry keyobj - the entry valueException - any exceptionpublic void onGet(CacheListenerContext context, K key, HashCode<V> obj) throws Exception
onGet in interface CacheListener<K extends Serializable,HashCode<V>>context - the listener contextkey - the entry keyobj - the entry valueException - any exceptionpublic void onClearCache(CacheListenerContext context) throws Exception
CacheListeneronClearCache in interface CacheListener<K extends Serializable,HashCode<V>>context - the listener contextException - any exceptionCacheListener.onClearCache(org.exoplatform.services.cache.CacheListenerContext)Copyright © 2021 eXo Platform SAS. All Rights Reserved.