Class 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 Detail

      • InMemoryCacheStatistics

        public InMemoryCacheStatistics()
    • Method Detail

      • count

        public long count​(String cacheName,
                          TransactionStats.OpType opType)
        Description copied from interface: CacheStatistics
        Get the number of occurrences of the given operation type, retrieve the number of cache hits that have happened to the cache.
        Specified by:
        count in interface CacheStatistics
        Parameters:
        cacheName - Name of the cache.
        opType - Type of cache operation.
        Returns:
        long count
      • meanTime

        public double meanTime​(String cacheName,
                               TransactionStats.OpType opType)
        Description copied from interface: CacheStatistics
        The mean time in nanoseconds for all operations of the given type.
        Specified by:
        meanTime in interface CacheStatistics
        Parameters:
        cacheName - The cache name.
        opType - Type of operation, e.g. cache hits.
        Returns:
        Time in nanos (double) or NaN if not available yet.
      • hitMissRatio

        public double hitMissRatio​(String cacheName)
        Description copied from interface: CacheStatistics
        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.
        Specified by:
        hitMissRatio in interface CacheStatistics
        Parameters:
        cacheName - The cache name.
        Returns:
        ratio (double)
      • numGets

        public long numGets​(String cacheName)
        Description copied from interface: CacheStatistics
        Retrieve the total number of get operations invoked on the cache (i.e. sum of hits and misses).
        Specified by:
        numGets in interface CacheStatistics
        Parameters:
        cacheName - The cache name.
        Returns:
        Count of get operations.
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Throws:
        org.springframework.beans.BeansException