Class AbstractCache.SimpleStatsCounter

    • Constructor Detail

      • SimpleStatsCounter

        public SimpleStatsCounter()
        Constructs an instance with all counts initialized to zero.
    • Method Detail

      • recordHits

        public void recordHits​(int count)
        Description copied from interface: AbstractCache.StatsCounter
        Records cache hits. This should be called when a cache request returns a cached value.
        Specified by:
        recordHits in interface AbstractCache.StatsCounter
        Parameters:
        count - the number of hits to record
        Since:
        11.0
      • recordMisses

        public void recordMisses​(int count)
        Description copied from interface: AbstractCache.StatsCounter
        Records cache misses. This should be called when a cache request returns a value that was not found in the cache. This method should be called by the loading thread, as well as by threads blocking on the load. Multiple concurrent calls to Cache lookup methods with the same key on an absent value should result in a single call to either recordLoadSuccess or recordLoadException and multiple calls to this method, despite all being served by the results of a single load operation.
        Specified by:
        recordMisses in interface AbstractCache.StatsCounter
        Parameters:
        count - the number of misses to record
        Since:
        11.0
      • recordLoadSuccess

        public void recordLoadSuccess​(long loadTime)
        Description copied from interface: AbstractCache.StatsCounter
        Records the successful load of a new entry. This should be called when a cache request causes an entry to be loaded, and the loading completes successfully. In contrast to AbstractCache.StatsCounter.recordMisses(int), this method should only be called by the loading thread.
        Specified by:
        recordLoadSuccess in interface AbstractCache.StatsCounter
        Parameters:
        loadTime - the number of nanoseconds the cache spent computing or retrieving the new value
      • recordLoadException

        public void recordLoadException​(long loadTime)
        Description copied from interface: AbstractCache.StatsCounter
        Records the failed load of a new entry. This should be called when a cache request causes an entry to be loaded, but an exception is thrown while loading the entry. In contrast to AbstractCache.StatsCounter.recordMisses(int), this method should only be called by the loading thread.
        Specified by:
        recordLoadException in interface AbstractCache.StatsCounter
        Parameters:
        loadTime - the number of nanoseconds the cache spent computing or retrieving the new value prior to an exception being thrown