Package org.ametys.core.cache
Interface CacheStats
- All Known Implementing Classes:
GuavaCacheStats
public interface CacheStats
CacheStats store hit, miss, and evictions of a cache.
It can also compute rates, and compute the sum/difference between two CacheStats
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the number of times an entry has been evicted.double
Returns the ratio of cache requests that lead to an eviction.long
hitCount()
Returns the number of times cache lookup methods have returned a cached value.double
hitRate()
Returns the ratio of cache requests which were hits.minus
(CacheStats cacheStats) Returns a new CacheStats representing the difference between this CacheStats and other.long
Returns the number of times cache lookup methods have returned an uncached (newly loaded) value, or null.double
missRate()
Returns the ratio of cache requests which were misses.plus
(CacheStats cacheStats) Returns a new CacheStats representing the sum between this CacheStats and otherlong
Returns the number of times cache lookup methods have returned either a cached or uncached value.
-
Method Details
-
requestCount
long requestCount()Returns the number of times cache lookup methods have returned either a cached or uncached value. This is defined as hitCount + missCount.- Returns:
- the number of times cache lookup methods have returned either a cached or uncached value.
-
hitCount
long hitCount()Returns the number of times cache lookup methods have returned a cached value.- Returns:
- the number of times cache lookup methods have returned a cached value.
-
hitRate
double hitRate()Returns the ratio of cache requests which were hits. This is defined as hitCount/requestCount. If requestCount equals 0, return 1- Returns:
- the ratio of cache requests which were hits.
-
missCount
long missCount()Returns the number of times cache lookup methods have returned an uncached (newly loaded) value, or null.- Returns:
- missCount
-
missRate
double missRate()Returns the ratio of cache requests which were misses. This is defined as missCount/requestCount. If requestCount equals 0, return 0- Returns:
- the ratio of cache requests which were misses.
-
evictionCount
long evictionCount()Returns the number of times an entry has been evicted. This count does not include manual invalidations.- Returns:
- the number of times an entry has been evicted.
-
evictionRate
double evictionRate()Returns the ratio of cache requests that lead to an eviction. This is defined as evictionCount/requestCount. If requestCount equals 0, return 0- Returns:
- the ratio of cache requests that lead to an eviction.
-
minus
Returns a new CacheStats representing the difference between this CacheStats and other.- Parameters:
cacheStats
- the other CacheStats- Returns:
- the CacheStats representing the difference between this CacheStats and other.
-
plus
Returns a new CacheStats representing the sum between this CacheStats and other- Parameters:
cacheStats
- the other CacheStats- Returns:
- the new CacheStats representing the sum between this CacheStats and other.
-