Class DefaultCacheStatistics
- java.lang.Object
- org.springframework.boot.actuate.cache.DefaultCacheStatistics
- All Implemented Interfaces:
CacheStatistics
public class DefaultCacheStatistics extends Object implements CacheStatistics
A defaultCacheStatistics
implementation.- Since:
- 1.3.0
Constructor Summary
Constructors Constructor Description DefaultCacheStatistics()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Double
getHitRatio()
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%.Double
getMissRatio()
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%.Long
getSize()
Return the size of the cache ornull
if that information is not available.void
setGetCacheCounts(long hitCount, long missCount)
void
setHitRatio(Double hitRatio)
void
setMissRatio(Double missRatio)
void
setSize(Long size)
Collection<Metric<?>>
toMetrics(String prefix)
Generate the relevantMetric
instances based on the specified prefix.
Constructor Detail
DefaultCacheStatistics
public DefaultCacheStatistics()
Method Detail
toMetrics
public Collection<Metric<?>> toMetrics(String prefix)
Description copied from interface:CacheStatistics
Generate the relevantMetric
instances based on the specified prefix.- Specified by:
toMetrics
in 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:CacheStatistics
Return the size of the cache ornull
if that information is not available.- Specified by:
getSize
in interfaceCacheStatistics
- Returns:
- the size of the cache or
null
getHitRatio
public Double getHitRatio()
Description copied from interface:CacheStatistics
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%.This may also return
null
if the cache-specifics statistics does not provide the necessary information- Specified by:
getHitRatio
in interfaceCacheStatistics
- Returns:
- the hit ratio or
null
setHitRatio
public void setHitRatio(Double hitRatio)
getMissRatio
public Double getMissRatio()
Description copied from interface:CacheStatistics
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%.This may also return
null
if the cache-specifics statistics does not provide the necessary information- Specified by:
getMissRatio
in interfaceCacheStatistics
- Returns:
- the miss ratio or
null
setMissRatio
public void setMissRatio(Double missRatio)