Interface ICacheStats

All Known Implementing Classes:
BoxCacheStats

public interface ICacheStats
Every cache provider in BoxLang must adhere to this interface in order to provide statistics about the cache it manages. If your cache doesn't implement a method, then make sure it returns a default value.
  • Method Details

    • hitRate

      int hitRate()
      Get the cache's hit rate = hits / (hits + misses)
      Returns:
      The hit ratio
    • objectCount

      int objectCount()
      How many entries are in the cache. This should take a live snapshot.
      Returns:
      The live object count regardless of expiration
    • expiredCount

      int expiredCount()
      How many entries are expired in the cache. This should take a live snapshot.
      Returns:
      The expired count
    • reset

      ICacheStats reset()
      Reset the cache's statistics
      Returns:
      The stats object
    • garbageCollections

      long garbageCollections()
      Get the total cache's garbage collections of Soft/Weak references
      Returns:
      The garbage collections
    • evictionCount

      long evictionCount()
      Get the total cache's evictions due to cache constraints (e.g. size, memory, etc)
      Returns:
      The eviction count
    • hits

      long hits()
      Get the total cache's hits
      Returns:
      The hits
    • misses

      long misses()
      Get the total cache's misses
      Returns:
      The misses
    • lastReapDatetime

      Instant lastReapDatetime()
      Get the date/time of the last reap the cache did
      Returns:
      date/time or null if never reaped
    • reapCount

      long reapCount()
      How many times the cache has been reaped
      Returns:
      The reap count
    • started

      Instant started()
      When the cache was started
    • size

      long size()
      Get the total cache's size in bytes
      Returns:
      The size in bytes
    • toStruct

      IStruct toStruct()
      Get a Struct representation of the cache's statistics
    • recordEviction

      ICacheStats recordEviction()
      Record an eviction hit
    • recordHit

      ICacheStats recordHit()
      Record a cache hit
    • recordMiss

      ICacheStats recordMiss()
      Record a cache miss
    • recordGCHit

      ICacheStats recordGCHit()
      Record a cache garbage collection
    • recordReap

      ICacheStats recordReap()
      Record a cache reap