Package org.wso2.carbon.caching.impl
Class CacheStatisticsImpl
- java.lang.Object
-
- org.wso2.carbon.caching.impl.CacheStatisticsImpl
-
- All Implemented Interfaces:
CacheStatistics
public class CacheStatisticsImpl extends Object implements CacheStatistics
TODO: class description
-
-
Constructor Summary
Constructors Constructor Description CacheStatisticsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the statistics counters to 0 for the associated Cache.floatgetAverageGetMillis()The mean time to execute gets.floatgetAveragePutMillis()The mean time to execute puts.floatgetAverageRemoveMillis()The mean time to execute removes.longgetCacheEvictions()The total number of evictions from the cache.longgetCacheGets()The total number of requests to the cache.floatgetCacheHitPercentage()This is a measure of cache efficiency.longgetCacheHits()The number of get requests that were satisfied by the cache.longgetCacheMisses()A miss is a get request which is not satisfied.floatgetCacheMissPercentage()Returns the percentage of cache accesses that did not find a requested entry in the cache.longgetCachePuts()The total number of puts to the cache.longgetCacheRemovals()The total number of removals from the cache.DategetStartAccumulationDate()The date from which statistics have been accumulated.
-
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:CacheStatisticsClears the statistics counters to 0 for the associated Cache.- Specified by:
clearin interfaceCacheStatistics
-
getStartAccumulationDate
public Date getStartAccumulationDate()
Description copied from interface:CacheStatisticsThe date from which statistics have been accumulated. Because statistics can be cleared, this is not necessarily since the cache was started.- Specified by:
getStartAccumulationDatein interfaceCacheStatistics- Returns:
- the date statistics started being accumulated
-
getCacheHits
public long getCacheHits()
Description copied from interface:CacheStatisticsThe number of get requests that were satisfied by the cache. In a caches with multiple tiered storage, a hit may be implemented as a hit to the cache or to the first tier.- Specified by:
getCacheHitsin interfaceCacheStatistics- Returns:
- the number of hits
-
getCacheHitPercentage
public float getCacheHitPercentage()
Description copied from interface:CacheStatisticsThis is a measure of cache efficiency. It is calculated asCacheStatistics.getCacheHits()divided byCacheStatistics.getCacheGets()* 100.- Specified by:
getCacheHitPercentagein interfaceCacheStatistics- Returns:
- the percentage of successful hits, as a decimal e.g 75.
-
getCacheMisses
public long getCacheMisses()
Description copied from interface:CacheStatisticsA miss is a get request which is not satisfied. In a simple cache a miss occurs when the cache does not satisfy the request. In a caches with multiple tiered storage, a miss may be implemented as a miss to the cache or to the first tier. In a read-through cache a miss is an absence of the key in the cache which will trigger a call to a CacheLoader. So it is still a miss even though the cache will load and return the value. Refer to the implementation for precise semantics.- Specified by:
getCacheMissesin interfaceCacheStatistics- Returns:
- the number of misses
-
getCacheMissPercentage
public float getCacheMissPercentage()
Description copied from interface:CacheStatisticsReturns the percentage of cache accesses that did not find a requested entry in the cache. This is calculated asCacheStatistics.getCacheMisses()divided byCacheStatistics.getCacheGets()* 100.- Specified by:
getCacheMissPercentagein interfaceCacheStatistics- Returns:
- the percentage of accesses that failed to find anything
-
getCacheGets
public long getCacheGets()
Description copied from interface:CacheStatisticsThe total number of requests to the cache. This will be equal to the sum of the hits and misses. A "get" is an operation that returns the current or previous value. It does not include checking for the existence of a key. In a caches with multiple tiered storage, a gets may be implemented as a get to the cache or to the first tier.- Specified by:
getCacheGetsin interfaceCacheStatistics- Returns:
- the number of gets
-
getCachePuts
public long getCachePuts()
Description copied from interface:CacheStatisticsThe total number of puts to the cache. A put is counted even if it is immediately evicted. Replaces, where a put occurs which overrides an existing mapping is counted as a put.- Specified by:
getCachePutsin interfaceCacheStatistics- Returns:
- the number of hits
-
getCacheRemovals
public long getCacheRemovals()
Description copied from interface:CacheStatisticsThe total number of removals from the cache. This does not include evictions, where the cache itself initiates the removal to make space.- Specified by:
getCacheRemovalsin interfaceCacheStatistics- Returns:
- the number of hits
-
getCacheEvictions
public long getCacheEvictions()
Description copied from interface:CacheStatisticsThe total number of evictions from the cache. An eviction is a removal initiated by the cache itself to free up space. An eviction is not treated as a removal and does not appear in the removal counts.- Specified by:
getCacheEvictionsin interfaceCacheStatistics- Returns:
- the number of evictions from the cache
-
getAverageGetMillis
public float getAverageGetMillis()
Description copied from interface:CacheStatisticsThe mean time to execute gets. In a read-through cache the time taken to load an entry on miss is not included in get time.- Specified by:
getAverageGetMillisin interfaceCacheStatistics- Returns:
- the time in milliseconds
-
getAveragePutMillis
public float getAveragePutMillis()
Description copied from interface:CacheStatisticsThe mean time to execute puts.- Specified by:
getAveragePutMillisin interfaceCacheStatistics- Returns:
- the time in milliseconds
-
getAverageRemoveMillis
public float getAverageRemoveMillis()
Description copied from interface:CacheStatisticsThe mean time to execute removes.- Specified by:
getAverageRemoveMillisin interfaceCacheStatistics- Returns:
- the time in milliseconds
-
-