Class DataStoreStatusProvider.CacheStats

  • Enclosing interface:
    DataStoreStatusProvider

    public static final class DataStoreStatusProvider.CacheStats
    extends java.lang.Object
    A snapshot of cache statistics. The statistics are cumulative across the lifetime of the data store.

    This is based on the data provided by Guava's caching framework. The SDK currently uses Guava internally, but is not guaranteed to always do so, and to avoid embedding Guava API details in the SDK API this is provided as a separate class.

    Since:
    4.12.0
    See Also:
    DataStoreStatusProvider.getCacheStats(), PersistentDataStoreBuilder.recordCacheStats(boolean)
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheStats​(long hitCount, long missCount, long loadSuccessCount, long loadExceptionCount, long totalLoadTime, long evictionCount)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)  
      long getEvictionCount()
      The number of times cache entries have been evicted.
      long getHitCount()
      The number of data queries that received cached data instead of going to the underlying data store.
      long getLoadExceptionCount()
      The number of times that an error occurred while querying the underlying data store.
      long getLoadSuccessCount()
      The number of times a cache miss resulted in successfully loading a data store item (or finding that it did not exist in the store).
      long getMissCount()
      The number of data queries that did not find cached data and went to the underlying data store.
      long getTotalLoadTime()
      The total number of nanoseconds that the cache has spent loading new values.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CacheStats

        public CacheStats​(long hitCount,
                          long missCount,
                          long loadSuccessCount,
                          long loadExceptionCount,
                          long totalLoadTime,
                          long evictionCount)
        Constructs a new instance.
        Parameters:
        hitCount - number of queries that produced a cache hit
        missCount - number of queries that produced a cache miss
        loadSuccessCount - number of cache misses that loaded a value without an exception
        loadExceptionCount - number of cache misses that tried to load a value but got an exception
        totalLoadTime - number of nanoseconds spent loading new values
        evictionCount - number of cache entries that have been evicted
    • Method Detail

      • getHitCount

        public long getHitCount()
        The number of data queries that received cached data instead of going to the underlying data store.
        Returns:
        the number of cache hits
      • getMissCount

        public long getMissCount()
        The number of data queries that did not find cached data and went to the underlying data store.
        Returns:
        the number of cache misses
      • getLoadSuccessCount

        public long getLoadSuccessCount()
        The number of times a cache miss resulted in successfully loading a data store item (or finding that it did not exist in the store).
        Returns:
        the number of successful loads
      • getLoadExceptionCount

        public long getLoadExceptionCount()
        The number of times that an error occurred while querying the underlying data store.
        Returns:
        the number of failed loads
      • getTotalLoadTime

        public long getTotalLoadTime()
        The total number of nanoseconds that the cache has spent loading new values.
        Returns:
        total time spent for all cache loads
      • getEvictionCount

        public long getEvictionCount()
        The number of times cache entries have been evicted.
        Returns:
        the number of evictions
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object