Class AbstractCacheStats

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String cacheInfoAsString()
      Gathers the stats of the cache for logging.
      double getAverageLoadPenalty()
      Returns the average time spent loading new values.
      long getEvictionCount()
      Returns the number of times an entry has been evicted.
      long getHitCount()
      Returns the number of times com.google.common.cache.Cache lookup methods have returned a cached value.
      double getHitRate()
      Returns the ratio of cache requests which were hits.
      long getLoadCount()
      Returns the total number of times that com.google.common.cache.Cache lookup methods attempted to load new values.
      long getLoadExceptionCount()
      Returns the number of times com.google.common.cache.Cache lookup methods threw an exception while loading a new value.
      double getLoadExceptionRate()
      Returns the ratio of cache loading attempts which threw exceptions.
      long getLoadSuccessCount()
      Returns the number of times com.google.common.cache.Cache lookup methods have successfully loaded a new value.
      long getMissCount()
      Returns the number of times com.google.common.cache.Cache lookup methods have returned an uncached (newly loaded) value, or null.
      double getMissRate()
      Returns the ratio of cache requests which were misses.
      @NotNull java.lang.String getName()  
      long getRequestCount()
      Returns the number of times com.google.common.cache.Cache lookup methods have returned either a cached or uncached value.
      long getTotalLoadTime()
      Returns the total number of nanoseconds the cache has spent loading new values.
      void resetStats()
      Reset the cache stats
      static java.lang.String timeInWords​(long nanos)  
      • Methods inherited from class javax.management.StandardMBean

        getAttribute, getAttributes, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Specified by:
        getName in interface CacheStatsMBean
      • getRequestCount

        public long getRequestCount()
        Description copied from interface: CacheStatsMBean
        Returns the number of times com.google.common.cache.Cache lookup methods have returned either a cached or uncached value. This is defined as getHitCount + getMissCount.
        Specified by:
        getRequestCount in interface CacheStatsMBean
      • getHitCount

        public long getHitCount()
        Description copied from interface: CacheStatsMBean
        Returns the number of times com.google.common.cache.Cache lookup methods have returned a cached value.
        Specified by:
        getHitCount in interface CacheStatsMBean
      • getHitRate

        public double getHitRate()
        Description copied from interface: CacheStatsMBean
        Returns the ratio of cache requests which were hits. This is defined as getHitCount / getRequestCount, or 1.0 when getRequestCount == 0. Note that getHitRate + getMissRate =~ 1.0.
        Specified by:
        getHitRate in interface CacheStatsMBean
      • getMissCount

        public long getMissCount()
        Description copied from interface: CacheStatsMBean
        Returns the number of times com.google.common.cache.Cache lookup methods have returned an uncached (newly loaded) value, or null. Multiple concurrent calls to com.google.common.cache.Cache lookup methods on an absent value can result in multiple misses, all returning the results of a single cache load operation.
        Specified by:
        getMissCount in interface CacheStatsMBean
      • getMissRate

        public double getMissRate()
        Description copied from interface: CacheStatsMBean
        Returns the ratio of cache requests which were misses. This is defined as getMissCount / getRequestCount, or 0.0 when getRequestCount == 0. Note that getHitRate + getMissRate =~ 1.0. Cache misses include all requests which weren't cache hits, including requests which resulted in either successful or failed loading attempts, and requests which waited for other threads to finish loading. It is thus the case that getMissCount >= getLoadSuccessCount + getLoadExceptionCount. Multiple concurrent misses for the same key will result in a single load operation.
        Specified by:
        getMissRate in interface CacheStatsMBean
      • getLoadCount

        public long getLoadCount()
        Description copied from interface: CacheStatsMBean
        Returns the total number of times that com.google.common.cache.Cache lookup methods attempted to load new values. This includes both successful load operations, as well as those that threw exceptions. This is defined as getLoadSuccessCount + getLoadExceptionCount.
        Specified by:
        getLoadCount in interface CacheStatsMBean
      • getLoadExceptionCount

        public long getLoadExceptionCount()
        Description copied from interface: CacheStatsMBean
        Returns the number of times com.google.common.cache.Cache lookup methods threw an exception while loading a new value. This is always incremented in conjunction with getMissCount, though getMissCount is also incremented when cache loading completes successfully (see CacheStatsMBean.getLoadSuccessCount()). Multiple concurrent misses for the same key will result in a single load operation.
        Specified by:
        getLoadExceptionCount in interface CacheStatsMBean
      • getLoadExceptionRate

        public double getLoadExceptionRate()
        Description copied from interface: CacheStatsMBean
        Returns the ratio of cache loading attempts which threw exceptions. This is defined as getLoadExceptionCount / (getLoadSuccessCount + getLoadExceptionCount), or 0.0 when getLoadSuccessCount + getLoadExceptionCount == 0.
        Specified by:
        getLoadExceptionRate in interface CacheStatsMBean
      • getTotalLoadTime

        public long getTotalLoadTime()
        Description copied from interface: CacheStatsMBean
        Returns the total number of nanoseconds the cache has spent loading new values. This can be used to calculate the miss penalty. This value is increased every time getLoadSuccessCount or getLoadExceptionCount is incremented.
        Specified by:
        getTotalLoadTime in interface CacheStatsMBean
      • getAverageLoadPenalty

        public double getAverageLoadPenalty()
        Description copied from interface: CacheStatsMBean
        Returns the average time spent loading new values. This is defined as getTotalLoadTime / (getLoadSuccessCount + getLoadExceptionCount).
        Specified by:
        getAverageLoadPenalty in interface CacheStatsMBean
      • getEvictionCount

        public long getEvictionCount()
        Description copied from interface: CacheStatsMBean
        Returns the number of times an entry has been evicted. This count does not include manual com.google.common.cache.Cache#invalidate invalidations.
        Specified by:
        getEvictionCount in interface CacheStatsMBean
      • timeInWords

        public static java.lang.String timeInWords​(long nanos)