|
eXo Kernel :: Component :: Cache Service 2.4.10-UXP01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.services.cache.invalidation.InvalidationExoCache<K,V>
public class InvalidationExoCache<K extends Serializable,V>
This eXo cache type is a decorator allowing ExoCache instances that have big values or non serializable values to be replicated thanks to an invalidation mechanism. To prevent infinite loop described below, we replicate the hash code of the value such that if the hash code is the same, we don't invalidate the value locally
| Nested Class Summary | |
|---|---|
static class |
InvalidationExoCache.HashCode<V>
We use this class to propagate the hash code of the value efficiently over the network |
| Constructor Summary | |
|---|---|
InvalidationExoCache(ExoCache<K,V> delegate)
|
|
InvalidationExoCache(ExoCache<K,V> delegate,
int concurrencyLevel)
|
|
| Method Summary | |
|---|---|
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,
InvalidationExoCache.HashCode<V> obj)
An entry is expired from the cache. |
void |
onGet(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
An entry is retrieved from the cache. |
void |
onPut(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
An entry is inserted in the cache. |
void |
onRemove(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
An entry is removed from the cache. |
void |
put(K key,
V value)
Performs a put in the cache. |
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 |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public 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.| Method Detail |
|---|
public String getName()
ExoCache
getName in interface ExoCache<K extends Serializable,V>ExoCache.getName()public void setName(String name)
ExoCache
setName in interface ExoCache<K extends Serializable,V>name - the cache nameExoCache.setName(java.lang.String)public String getLabel()
ExoCache
getLabel in interface ExoCache<K extends Serializable,V>ExoCache.getLabel()public void setLabel(String s)
ExoCache
setLabel in interface ExoCache<K extends Serializable,V>s - the cache labelExoCache.setLabel(java.lang.String)public V get(Serializable name)
ExoCache
get in interface ExoCache<K extends Serializable,V>name - the cache key
ExoCache.get(java.io.Serializable)
public V remove(Serializable key)
throws NullPointerException
ExoCache
remove in interface ExoCache<K extends Serializable,V>key - the cache key
NullPointerException - if the provided key is nullExoCache.remove(java.io.Serializable)
public void put(K key,
V value)
throws NullPointerException
ExoCache
put in interface ExoCache<K extends Serializable,V>key - the cache keyvalue - the cached value
NullPointerException - if the key is nullExoCache.put(java.io.Serializable, java.lang.Object)
public void putMap(Map<? extends K,? extends V> objs)
throws IllegalArgumentException
ExoCache
putMap in interface ExoCache<K extends Serializable,V>objs - the objects to put
IllegalArgumentException - if the provided map contains a null keyExoCache.putMap(java.util.Map)public void clearCache()
ExoCache
clearCache in interface ExoCache<K extends Serializable,V>ExoCache.clearCache()
public void select(CachedObjectSelector<? super K,? super V> selector)
throws Exception
ExoCache
select in interface ExoCache<K extends Serializable,V>selector - the selector
Exception - any exceptionExoCache.select(org.exoplatform.services.cache.CachedObjectSelector)public int getCacheSize()
ExoCache
getCacheSize in interface ExoCache<K extends Serializable,V>ExoCache.getCacheSize()public int getMaxSize()
ExoCache
getMaxSize in interface ExoCache<K extends Serializable,V>ExoCache.getMaxSize()public void setMaxSize(int max)
ExoCache
setMaxSize in interface ExoCache<K extends Serializable,V>max - the maximum capacityExoCache.setMaxSize(int)public long getLiveTime()
ExoCache
getLiveTime in interface ExoCache<K extends Serializable,V>ExoCache.getLiveTime()public void setLiveTime(long period)
ExoCache
setLiveTime in interface ExoCache<K extends Serializable,V>period - the live timeExoCache.setLiveTime(long)public int getCacheHit()
ExoCache
getCacheHit in interface ExoCache<K extends Serializable,V>ExoCache.getCacheHit()public int getCacheMiss()
ExoCache
getCacheMiss in interface ExoCache<K extends Serializable,V>ExoCache.getCacheMiss()public List<? extends V> getCachedObjects()
ExoCache
getCachedObjects in interface ExoCache<K extends Serializable,V>ExoCache.getCachedObjects()public List<? extends V> removeCachedObjects()
ExoCache
removeCachedObjects in interface ExoCache<K extends Serializable,V>ExoCache.removeCachedObjects()
public void addCacheListener(CacheListener<? super K,? super V> listener)
throws IllegalArgumentException
ExoCache
addCacheListener in interface ExoCache<K extends Serializable,V>listener - the listener to add
IllegalArgumentExceptionExoCache.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,
InvalidationExoCache.HashCode<V> obj)
throws Exception
onExpire in interface CacheListener<K extends Serializable,InvalidationExoCache.HashCode<V>>context - the listener contextkey - the entry keyobj - the entry value
Exception - any exception
public void onRemove(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
throws Exception
onRemove in interface CacheListener<K extends Serializable,InvalidationExoCache.HashCode<V>>context - the listener contextkey - the entry keyobj - the entry value
Exception - any exception
public void onPut(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
throws Exception
onPut in interface CacheListener<K extends Serializable,InvalidationExoCache.HashCode<V>>context - the listener contextkey - the entry keyobj - the entry value
Exception - any exception
public void onGet(CacheListenerContext context,
K key,
InvalidationExoCache.HashCode<V> obj)
throws Exception
onGet in interface CacheListener<K extends Serializable,InvalidationExoCache.HashCode<V>>context - the listener contextkey - the entry keyobj - the entry value
Exception - any exception
public void onClearCache(CacheListenerContext context)
throws Exception
CacheListener
onClearCache in interface CacheListener<K extends Serializable,InvalidationExoCache.HashCode<V>>context - the listener context
Exception - any exceptionCacheListener.onClearCache(org.exoplatform.services.cache.CacheListenerContext)
|
eXo Kernel :: Component :: Cache Service 2.4.10-UXP01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||