Interface CacheStatistics

  • All Known Implementing Classes:
    DefaultCacheStatistics

    public interface CacheStatistics
    Snapshot of the statistics of a given cache. CacheStatistics instances have a very short life as it represents the statistics of a cache at one particular point in time.
    Since:
    1.3.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      DoublegetHitRatio()
      Return the ratio of cache requests which were hits as a value between 0 and 1 where 0 means that the hit ratio is 0% and 1 means it is 100%.
      DoublegetMissRatio()
      Return the ratio of cache requests which were misses as value between 0 and 1 where 0 means that the miss ratio is 0% and 1 means it is 100%.
      LonggetSize()
      Return the size of the cache or null if that information is not available.
      Collection<Metric<?>>toMetrics​(String prefix)
      Generate the relevant Metric instances based on the specified prefix.
    • Method Detail

      • toMetrics

        Collection<Metric<?>> toMetrics​(String prefix)
        Generate the relevant Metric instances based on the specified prefix.
        Parameters:
        prefix - the metrics prefix (ends with '.')
        Returns:
        the metrics corresponding to this instance
      • getSize

        Long getSize()
        Return the size of the cache or null if that information is not available.
        Returns:
        the size of the cache or null
      • getHitRatio

        Double getHitRatio()
        Return the ratio of cache requests which were hits as a value between 0 and 1 where 0 means that the hit ratio is 0% and 1 means it is 100%.

        This may also return null if the cache-specifics statistics does not provide the necessary information

        Returns:
        the hit ratio or null
      • getMissRatio

        Double getMissRatio()
        Return the ratio of cache requests which were misses as value between 0 and 1 where 0 means that the miss ratio is 0% and 1 means it is 100%.

        This may also return null if the cache-specifics statistics does not provide the necessary information

        Returns:
        the miss ratio or null