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()
CacheStatistics
Returns the effectiveness of a cache: hits / (hits + misses)
getEffectiveness
in interface CacheStatistics
public long getCurrentEntries()
CacheStatistics
Returns the amount of current entries cached.
getCurrentEntries
in interface CacheStatistics
public long getEntriesHit()
CacheStatistics
Returns the amount of entries hit.
getEntriesHit
in interface CacheStatistics
public long getEntriesMissed()
CacheStatistics
Returns the amount of entries missed.
getEntriesMissed
in interface CacheStatistics
public long getEntriesEvicted()
CacheStatistics
Returns the amount of entries evicted.
getEntriesEvicted
in interface CacheStatistics
public long getCacheClearedCount()
CacheStatistics
Returns how many times the cache has been cleared completely.
getCacheClearedCount
in interface CacheStatistics
public String getName()
CacheStatistics
Returns the name of the cache.
getName
in interface CacheStatistics
getName
in interface org.springframework.cache.Cache
public Object getNativeCache()
getNativeCache
in interface org.springframework.cache.Cache
public org.springframework.cache.Cache.ValueWrapper get(Object key)
get
in interface org.springframework.cache.Cache
public <T> T get(Object key, Class<T> type)
get
in interface org.springframework.cache.Cache
public <T> T get(Object key, Callable<T> valueLoader)
get
in interface org.springframework.cache.Cache
public void put(Object key, Object value)
put
in interface org.springframework.cache.Cache
public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, Object value)
putIfAbsent
in interface org.springframework.cache.Cache
public void evict(Object key)
evict
in interface org.springframework.cache.Cache
public void clear()
clear
in interface org.springframework.cache.Cache
Copyright © 2010 - 2019 edorasware ag. All Rights Reserved.