Package org.alfresco.repo.cache
Class InMemoryCacheStatistics
java.lang.Object
org.alfresco.repo.cache.InMemoryCacheStatistics
- All Implemented Interfaces:
CacheStatistics,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
public class InMemoryCacheStatistics
extends Object
implements CacheStatistics, org.springframework.context.ApplicationContextAware
Simple non-persistent implementation of
CacheStatistics. Statistics
are empty at repository startup.- Since:
- 5.0
- Author:
- Matt Ward
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String cacheName, TransactionStats txStats) Add new details to the system wide cache statistics.Retrieve a map containing a snapshot of all of the raw stats (e.g. counts, mean operation times etc.).longcount(String cacheName, TransactionStats.OpType opType) Get the number of occurrences of the given operation type, retrieve the number of cache hits that have happened to the cache.doublehitMissRatio(String cacheName) The hit ratio for the given cache, where 1.0 is the maximum possible value and 0.0 represents a cache that has never successfully returned a previously cached value.doublemeanTime(String cacheName, TransactionStats.OpType opType) The mean time in nanoseconds for all operations of the given type.longRetrieve the total number of get operations invoked on the cache (i.e. sum of hits and misses).voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Constructor Details
-
InMemoryCacheStatistics
public InMemoryCacheStatistics()
-
-
Method Details
-
count
Description copied from interface:CacheStatisticsGet the number of occurrences of the given operation type, retrieve the number of cache hits that have happened to the cache.- Specified by:
countin interfaceCacheStatistics- Parameters:
cacheName- Name of the cache.opType- Type of cache operation.- Returns:
- long count
-
meanTime
Description copied from interface:CacheStatisticsThe mean time in nanoseconds for all operations of the given type.- Specified by:
meanTimein interfaceCacheStatistics- Parameters:
cacheName- The cache name.opType- Type of operation, e.g. cache hits.- Returns:
- Time in nanos (double) or NaN if not available yet.
-
add
Description copied from interface:CacheStatisticsAdd new details to the system wide cache statistics.- Specified by:
addin interfaceCacheStatistics
-
hitMissRatio
Description copied from interface:CacheStatisticsThe hit ratio for the given cache, where 1.0 is the maximum possible value and 0.0 represents a cache that has never successfully returned a previously cached value.- Specified by:
hitMissRatioin interfaceCacheStatistics- Parameters:
cacheName- The cache name.- Returns:
- ratio (double)
-
numGets
Description copied from interface:CacheStatisticsRetrieve the total number of get operations invoked on the cache (i.e. sum of hits and misses).- Specified by:
numGetsin interfaceCacheStatistics- Parameters:
cacheName- The cache name.- Returns:
- Count of get operations.
-
allStats
Description copied from interface:CacheStatisticsRetrieve a map containing a snapshot of all of the raw stats (e.g. counts, mean operation times etc.). Since this is a snapshot it is unaffected by future modifications to the statistics - by usingCacheStatistics.add(String, TransactionStats)for example.- Specified by:
allStatsin interfaceCacheStatistics- Parameters:
cacheName- The cache name.- Returns:
- Map of OpType to OperationStats
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-