public class ConcurrentFIFOExoCache<K extends Serializable,V> extends Object implements ExoCache<K,V>
ExoCache implementation based on ConcurrentHashMap
that minimize locking. Cache entries are maintained in a fifo list that is used for the fifo eviction policy.| Constructor and Description |
|---|
ConcurrentFIFOExoCache() |
ConcurrentFIFOExoCache(int maxSize) |
ConcurrentFIFOExoCache(int maxSize,
Log log) |
ConcurrentFIFOExoCache(Log log) |
ConcurrentFIFOExoCache(String name,
int maxSize) |
ConcurrentFIFOExoCache(String name,
int maxSize,
Log log) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheListener(CacheListener<? super K,? super V> listener)
Add a listener.
|
void |
assertConsistent() |
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.
|
long |
getLiveTimeMillis() |
int |
getMaxSize()
Returns the maximum capacity of the cache.
|
String |
getName()
Returns the cache name
|
boolean |
isLogEnabled() |
void |
put(K name,
V obj)
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 name)
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 name)
Sets the cache label
|
void |
setLiveTime(long period)
Sets the maximum life time of an entry in the cache.
|
void |
setLiveTimeMillis(long liveTimeMillis) |
void |
setLogEnabled(boolean logEnabled) |
void |
setMaxSize(int max)
Sets the maximum capacity of the cache.
|
void |
setName(String s)
Sets the cache name.
|
public ConcurrentFIFOExoCache()
public ConcurrentFIFOExoCache(Log log)
public ConcurrentFIFOExoCache(int maxSize)
public ConcurrentFIFOExoCache(int maxSize,
Log log)
public ConcurrentFIFOExoCache(String name, int maxSize)
public void assertConsistent()
public String getName()
ExoCachegetName in interface ExoCache<K extends Serializable,V>public void setName(String s)
ExoCachesetName in interface ExoCache<K extends Serializable,V>s - the cache namepublic String getLabel()
ExoCachegetLabel in interface ExoCache<K extends Serializable,V>public void setLabel(String name)
ExoCachesetLabel in interface ExoCache<K extends Serializable,V>name - the cache labelpublic long getLiveTime()
ExoCachegetLiveTime in interface ExoCache<K extends Serializable,V>public void setLiveTime(long period)
ExoCachesetLiveTime in interface ExoCache<K extends Serializable,V>period - the live timepublic long getLiveTimeMillis()
public void setLiveTimeMillis(long liveTimeMillis)
public int getMaxSize()
ExoCachegetMaxSize in interface ExoCache<K extends Serializable,V>public void setMaxSize(int max)
ExoCachesetMaxSize in interface ExoCache<K extends Serializable,V>max - the maximum capacitypublic V get(Serializable name)
ExoCacheget in interface ExoCache<K extends Serializable,V>name - the cache keypublic void put(K name, V obj)
ExoCacheput in interface ExoCache<K extends Serializable,V>name - the cache keyobj - the cached valuepublic void putMap(Map<? extends K,? extends V> objs)
ExoCacheputMap in interface ExoCache<K extends Serializable,V>objs - the objects to putpublic V remove(Serializable name)
ExoCacheremove in interface ExoCache<K extends Serializable,V>name - the cache keypublic List<? extends V> getCachedObjects()
ExoCachegetCachedObjects in interface ExoCache<K extends Serializable,V>public List<? extends V> removeCachedObjects()
ExoCacheremoveCachedObjects in interface ExoCache<K extends Serializable,V>public void clearCache()
ExoCacheclearCache in interface ExoCache<K extends Serializable,V>public void select(CachedObjectSelector<? super K,? super V> selector) throws Exception
ExoCachepublic int getCacheSize()
ExoCachegetCacheSize in interface ExoCache<K extends Serializable,V>public int getCacheHit()
ExoCachegetCacheHit in interface ExoCache<K extends Serializable,V>public int getCacheMiss()
ExoCachegetCacheMiss in interface ExoCache<K extends Serializable,V>public void addCacheListener(CacheListener<? super K,? super V> listener)
ExoCacheaddCacheListener in interface ExoCache<K extends Serializable,V>listener - the listener to addpublic boolean isLogEnabled()
isLogEnabled in interface ExoCache<K extends Serializable,V>public void setLogEnabled(boolean logEnabled)
setLogEnabled in interface ExoCache<K extends Serializable,V>Copyright © 2015 eXo Platform SAS. All Rights Reserved.