Class SimpleCacheStatistics

    • Field Detail

      • m_cCacheHits

        protected volatile long m_cCacheHits
        The rough (ie unsynchronized) number of calls that could be answered from the front or the back and were answered by data in the front map.
      • m_cHitsMillis

        protected volatile long m_cHitsMillis
        Total number of milliseconds used for get operations that were hits since the last statistics reset.
      • m_cCacheMisses

        protected volatile long m_cCacheMisses
        The rough (ie unsynchronized) number of calls that could be answered from the front or the back and were answered by data in the back map.
      • m_cMissesMillis

        protected volatile long m_cMissesMillis
        Total number of milliseconds used for get operations that were misses since the last statistics reset.
      • m_cCachePuts

        protected volatile long m_cCachePuts
        Total number of put operations since the last statistics reset.
      • m_cPutsMillis

        protected volatile long m_cPutsMillis
        Total number of milliseconds used for put operations since the last statistics reset.
      • m_cCachePrunes

        protected volatile long m_cCachePrunes
        Total number of evictions triggered based on the size of the cache since the last statistics reset.
      • m_cCachePrunesMillis

        protected volatile long m_cCachePrunesMillis
        Total number of milliseconds used for prune operations since the last statistics reset.
    • Constructor Detail

      • SimpleCacheStatistics

        public SimpleCacheStatistics()
        Default constructor.
    • Method Detail

      • getTotalGets

        public long getTotalGets()
        Determine the total number of get() operations since the cache statistics were last reset.
        Specified by:
        getTotalGets in interface CacheStatistics
        Returns:
        the total number of get() operations
      • getTotalGetsMillis

        public long getTotalGetsMillis()
        Determine the total number of milliseconds spent on get() operations since the cache statistics were last reset.
        Specified by:
        getTotalGetsMillis in interface CacheStatistics
        Returns:
        the total number of milliseconds processing get() operations
      • getAverageGetMillis

        public double getAverageGetMillis()
        Determine the average number of milliseconds per get() invocation since the cache statistics were last reset.
        Specified by:
        getAverageGetMillis in interface CacheStatistics
        Returns:
        the average number of milliseconds per get() operation
      • getTotalPuts

        public long getTotalPuts()
        Determine the total number of put() operations since the cache statistics were last reset.
        Specified by:
        getTotalPuts in interface CacheStatistics
        Returns:
        the total number of put() operations
      • getTotalPutsMillis

        public long getTotalPutsMillis()
        Determine the total number of milliseconds spent on put() operations since the cache statistics were last reset.
        Specified by:
        getTotalPutsMillis in interface CacheStatistics
        Returns:
        the total number of milliseconds processing put() operations
      • getAveragePutMillis

        public double getAveragePutMillis()
        Determine the average number of milliseconds per put() invocation since the cache statistics were last reset.
        Specified by:
        getAveragePutMillis in interface CacheStatistics
        Returns:
        the average number of milliseconds per put() operation
      • getCacheHits

        public long getCacheHits()
        Determine the rough number of cache hits since the cache statistics were last reset.

        A cache hit is a read operation invocation (e.g. get()) for which an entry exists in this map.

        Specified by:
        getCacheHits in interface CacheStatistics
        Returns:
        the number of get() calls that have been served by existing cache entries
      • getCacheHitsMillis

        public long getCacheHitsMillis()
        Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which an entry existed in this map.
        Specified by:
        getCacheHitsMillis in interface CacheStatistics
        Returns:
        the total number of milliseconds for the get() operations that were hits
      • getAverageHitMillis

        public double getAverageHitMillis()
        Determine the average number of milliseconds per get() invocation that is a hit.
        Specified by:
        getAverageHitMillis in interface CacheStatistics
        Returns:
        the average number of milliseconds per cache hit
      • getCacheMisses

        public long getCacheMisses()
        Determine the rough number of cache misses since the cache statistics were last reset.

        A cache miss is a get() invocation that does not have an entry in this map.

        Specified by:
        getCacheMisses in interface CacheStatistics
        Returns:
        the number of get() calls that failed to find an existing cache entry because the requested key was not in the cache
      • getCacheMissesMillis

        public long getCacheMissesMillis()
        Determine the total number of milliseconds (since the last statistics reset) for the get() operations for which no entry existed in this map.
        Specified by:
        getCacheMissesMillis in interface CacheStatistics
        Returns:
        the total number of milliseconds (since the last statistics reset) for the get() operations that were misses
      • getAverageMissMillis

        public double getAverageMissMillis()
        Determine the average number of milliseconds per get() invocation that is a miss.
        Specified by:
        getAverageMissMillis in interface CacheStatistics
        Returns:
        the average number of milliseconds per cache miss
      • getHitProbability

        public double getHitProbability()
        Determine the rough probability (0 <= p <= 1) that the next invocation will be a hit, based on the statistics collected since the last reset of the cache statistics.
        Specified by:
        getHitProbability in interface CacheStatistics
        Returns:
        the cache hit probability (0 <= p <= 1)
      • getCachePrunes

        public long getCachePrunes()
        Determine the rough number of cache pruning cycles since the cache statistics were last reset.

        For the LocalCache implementation, this refers to the number of times that the prune() method is executed.

        Specified by:
        getCachePrunes in interface CacheStatistics
        Returns:
        the total number of cache pruning cycles (since the last statistics reset)
      • getCachePrunesMillis

        public long getCachePrunesMillis()
        Determine the total number of milliseconds (since the last statistics reset) spent on cache pruning.

        For the LocalCache implementation, this refers to the time spent in the prune() method.

        Specified by:
        getCachePrunesMillis in interface CacheStatistics
        Returns:
        the total number of milliseconds (since the last statistics reset) for cache pruning operations
      • getAveragePruneMillis

        public double getAveragePruneMillis()
        Calculate the average number of milliseconds that a prune takes.
        Returns:
        the average number of milliseconds spent per pruning cycle
      • resetHitStatistics

        public void resetHitStatistics()
        Reset all of the cache statistics.

        Note that the method name implies that only the hit statistics are cleared, which is not the case; all of the statistics are cleared.

        Specified by:
        resetHitStatistics in interface CacheStatistics
      • toString

        public String toString()
        For debugging purposes, format the contents of the SimpleCachingStatistics in a human readable format.
        Overrides:
        toString in class Object
        Returns:
        a String representation of this object
      • registerHit

        public void registerHit()
        Register a cache hit (no timing information).
      • registerHit

        public void registerHit​(long lStartMillis)
        Register a cache hit.
        Parameters:
        lStartMillis - the time when the get operation started
      • registerHits

        public void registerHits​(int cHits,
                                 long lStartMillis)
        Register a multiple cache hit.
        Parameters:
        cHits - the number of hits
        lStartMillis - the time when the get operation started
      • registerMiss

        public void registerMiss()
        Register a cache miss (no timing information).
      • registerMiss

        public void registerMiss​(long lStartMillis)
        Register a cache miss.
        Parameters:
        lStartMillis - the time when the get operation started
      • registerMisses

        public void registerMisses​(int cMisses,
                                   long lStartMillis)
        Register a multiple cache miss.
        Parameters:
        cMisses - the number of misses
        lStartMillis - the time when the get operation started
      • registerPut

        public void registerPut​(long lStartMillis)
        Register a cache put.
        Parameters:
        lStartMillis - the time when the put operation started
      • registerPuts

        public void registerPuts​(int cPuts,
                                 long lStartMillis)
        Register a multiple cache put.
        Parameters:
        cPuts - the number of puts
        lStartMillis - the time when the put operation started
      • registerCachePrune

        public void registerCachePrune​(long lStartMillis)
        Register a cache prune.
        Parameters:
        lStartMillis - the time when the prune operation started
      • registerIncrementalCachePrune

        public void registerIncrementalCachePrune​(long lStartMillis)
        Register an incremental cache prune, which is to say that the time is accreted but the number of prunes does not increase.
        Parameters:
        lStartMillis - the time when the prune operation started
        Since:
        Coherence 3.5