Class DefaultCacheStatistics
- java.lang.Object
- org.springframework.boot.actuate.cache.DefaultCacheStatistics
- All Implemented Interfaces:
CacheStatistics
public class DefaultCacheStatistics extends Object implements CacheStatistics
A defaultCacheStatisticsimplementation.- Since:
- 1.3.0
Constructor Summary
Constructors Constructor Description DefaultCacheStatistics()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoublegetHitRatio()Return the ratio of cache requests which were hits as a value between 0 and 1 where 0 means that the hit ratio is 0% and 1 means it is 100%.DoublegetMissRatio()Return the ratio of cache requests which were misses as value between 0 and 1 where 0 means that the miss ratio is 0% and 1 means it is 100%.LonggetSize()Return the size of the cache ornullif that information is not available.voidsetGetCacheCounts(long hitCount, long missCount)voidsetHitRatio(Double hitRatio)voidsetMissRatio(Double missRatio)voidsetSize(Long size)Collection<Metric<?>>toMetrics(String prefix)Generate the relevantMetricinstances based on the specified prefix.
Constructor Detail
DefaultCacheStatistics
public DefaultCacheStatistics()
Method Detail
toMetrics
public Collection<Metric<?>> toMetrics(String prefix)
Description copied from interface:CacheStatisticsGenerate the relevantMetricinstances based on the specified prefix.- Specified by:
toMetricsin interfaceCacheStatistics- Parameters:
prefix- the metrics prefix (ends with '.')- Returns:
- the metrics corresponding to this instance
setGetCacheCounts
public void setGetCacheCounts(long hitCount, long missCount)
getSize
public Long getSize()
Description copied from interface:CacheStatisticsReturn the size of the cache ornullif that information is not available.- Specified by:
getSizein interfaceCacheStatistics- Returns:
- the size of the cache or
null
getHitRatio
public Double getHitRatio()
Description copied from interface:CacheStatisticsReturn the ratio of cache requests which were hits as a value between 0 and 1 where 0 means that the hit ratio is 0% and 1 means it is 100%.This may also return
nullif the cache-specifics statistics does not provide the necessary information- Specified by:
getHitRatioin interfaceCacheStatistics- Returns:
- the hit ratio or
null
setHitRatio
public void setHitRatio(Double hitRatio)
getMissRatio
public Double getMissRatio()
Description copied from interface:CacheStatisticsReturn the ratio of cache requests which were misses as value between 0 and 1 where 0 means that the miss ratio is 0% and 1 means it is 100%.This may also return
nullif the cache-specifics statistics does not provide the necessary information- Specified by:
getMissRatioin interfaceCacheStatistics- Returns:
- the miss ratio or
null
setMissRatio
public void setMissRatio(Double missRatio)