public class StatisticsAwareCacheWrapper extends Object implements org.springframework.cache.Cache, CacheStatistics
This class wraps a Cache and holds the statistical data to satisfy the CacheStatistics interface.
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
static StatisticsAwareCacheWrapper |
create(org.springframework.cache.Cache wrappedCache)
Creates a new instance based on the given
Cache. |
void |
evict(Object key) |
org.springframework.cache.Cache.ValueWrapper |
get(Object key) |
<T> T |
get(Object key,
Callable<T> valueLoader) |
<T> T |
get(Object key,
Class<T> type) |
long |
getCacheClearedCount()
Returns how many times the cache has been cleared completely.
|
long |
getCurrentEntries()
Returns the amount of current entries cached.
|
double |
getEffectiveness()
Returns the effectiveness of a cache: hits / (hits + misses)
|
long |
getEntriesEvicted()
Returns the amount of entries evicted.
|
long |
getEntriesHit()
Returns the amount of entries hit.
|
long |
getEntriesMissed()
Returns the amount of entries missed.
|
String |
getName()
Returns the name of the cache.
|
Object |
getNativeCache() |
void |
put(Object key,
Object value) |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
public static StatisticsAwareCacheWrapper create(org.springframework.cache.Cache wrappedCache)
Creates a new instance based on the given Cache.
wrappedCache - the cache for which to add statistical datapublic double getEffectiveness()
CacheStatisticsReturns the effectiveness of a cache: hits / (hits + misses)
getEffectiveness in interface CacheStatisticspublic long getCurrentEntries()
CacheStatisticsReturns the amount of current entries cached.
getCurrentEntries in interface CacheStatisticspublic long getEntriesHit()
CacheStatisticsReturns the amount of entries hit.
getEntriesHit in interface CacheStatisticspublic long getEntriesMissed()
CacheStatisticsReturns the amount of entries missed.
getEntriesMissed in interface CacheStatisticspublic long getEntriesEvicted()
CacheStatisticsReturns the amount of entries evicted.
getEntriesEvicted in interface CacheStatisticspublic long getCacheClearedCount()
CacheStatisticsReturns how many times the cache has been cleared completely.
getCacheClearedCount in interface CacheStatisticspublic String getName()
CacheStatisticsReturns the name of the cache.
getName in interface CacheStatisticsgetName in interface org.springframework.cache.Cachepublic Object getNativeCache()
getNativeCache in interface org.springframework.cache.Cachepublic org.springframework.cache.Cache.ValueWrapper get(Object key)
get in interface org.springframework.cache.Cachepublic <T> T get(Object key, Class<T> type)
get in interface org.springframework.cache.Cachepublic <T> T get(Object key, Callable<T> valueLoader)
get in interface org.springframework.cache.Cachepublic void put(Object key, Object value)
put in interface org.springframework.cache.Cachepublic org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, Object value)
putIfAbsent in interface org.springframework.cache.Cachepublic void evict(Object key)
evict in interface org.springframework.cache.Cachepublic void clear()
clear in interface org.springframework.cache.CacheCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.