Interface CacheStatistics

All Known Implementing Classes:
InMemoryCacheStatistics

public interface CacheStatistics
Centralised cache statistics service. Transactional caches participating in statistical collection will provide their data to this service using the add(String, TransactionStats) method. The data is then aggregated so that, for example, the hit ratio for a particular cache may be retrieved.
Since:
5.0
Author:
Matt Ward
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(String cacheName, TransactionStats stats)
    Add new details to the system wide cache statistics.
    allStats(String cacheName)
    Retrieve a map containing a snapshot of all of the raw stats (e.g. counts, mean operation times etc.).
    long
    count(String cacheName, TransactionStats.OpType opType)
    Get the number of occurrences of the given operation type, retrieve the number of cache hits that have happened to the cache.
    double
    hitMissRatio(String cacheName)
    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.
    double
    The mean time in nanoseconds for all operations of the given type.
    long
    numGets(String cacheName)
    Retrieve the total number of get operations invoked on the cache (i.e. sum of hits and misses).
  • Method Details

    • add

      void add(String cacheName, TransactionStats stats)
      Add new details to the system wide cache statistics.
    • count

      long count(String cacheName, TransactionStats.OpType opType)
      Get the number of occurrences of the given operation type, retrieve the number of cache hits that have happened to the cache.
      Parameters:
      cacheName - Name of the cache.
      opType - Type of cache operation.
      Returns:
      long count
    • meanTime

      double meanTime(String cacheName, TransactionStats.OpType opType)
      The mean time in nanoseconds for all operations of the given type.
      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

      double hitMissRatio(String cacheName)
      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.
      Parameters:
      cacheName - The cache name.
      Returns:
      ratio (double)
    • numGets

      long numGets(String cacheName)
      Retrieve the total number of get operations invoked on the cache (i.e. sum of hits and misses).
      Parameters:
      cacheName - The cache name.
      Returns:
      Count of get operations.
    • allStats

      Retrieve a map containing a snapshot of all of the raw stats (e.g. counts, mean operation times etc.). Since this is a snapshot it is unaffected by future modifications to the statistics - by using add(String, TransactionStats) for example.
      Parameters:
      cacheName - The cache name.
      Returns:
      Map of OpType to OperationStats