Class BoxCacheStats

java.lang.Object
ortus.boxlang.runtime.cache.util.BoxCacheStats
All Implemented Interfaces:
ICacheStats

public class BoxCacheStats extends Object implements ICacheStats
  • Constructor Details

    • BoxCacheStats

      public BoxCacheStats()
      Constructor
  • Method Details

    • recordEviction

      public ICacheStats recordEviction()
      Record an eviction hit
      Specified by:
      recordEviction in interface ICacheStats
    • recordHit

      public ICacheStats recordHit()
      Record a cache hit
      Specified by:
      recordHit in interface ICacheStats
    • recordMiss

      public ICacheStats recordMiss()
      Record a cache miss
      Specified by:
      recordMiss in interface ICacheStats
    • recordGCHit

      public ICacheStats recordGCHit()
      Record a cache garbage collection
      Specified by:
      recordGCHit in interface ICacheStats
    • recordReap

      public ICacheStats recordReap()
      Record a cache reap
      Specified by:
      recordReap in interface ICacheStats
    • hitRate

      public int hitRate()
      Get the cache's hit rate = hits / (hits + misses)
      Specified by:
      hitRate in interface ICacheStats
      Returns:
      The hit ratio in percentage or 0 if no hits or misses
    • objectCount

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

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

      public ICacheStats reset()
      Reset the cache's statistics
      Specified by:
      reset in interface ICacheStats
      Returns:
      The stats object
    • garbageCollections

      public long garbageCollections()
      Get the total cache's garbage collections of Soft/Weak references
      Specified by:
      garbageCollections in interface ICacheStats
      Returns:
      The garbage collections
    • evictionCount

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

      public long hits()
      Get the total cache's hits
      Specified by:
      hits in interface ICacheStats
      Returns:
      The hits
    • misses

      public long misses()
      Get the total cache's misses
      Specified by:
      misses in interface ICacheStats
      Returns:
      The misses
    • lastReapDatetime

      public Instant lastReapDatetime()
      Get the date/time of the last reap the cache did
      Specified by:
      lastReapDatetime in interface ICacheStats
      Returns:
      date/time or null if never reaped
    • reapCount

      public long reapCount()
      How many times the cache has been reaped
      Specified by:
      reapCount in interface ICacheStats
      Returns:
      The reap count
    • started

      public Instant started()
      When the cache was started
      Specified by:
      started in interface ICacheStats
    • size

      public long size()
      Get the total cache's size in bytes
      Specified by:
      size in interface ICacheStats
      Returns:
      The size in bytes
    • toStruct

      public IStruct toStruct()
      Get a Struct representation of the cache's statistics
      Specified by:
      toStruct in interface ICacheStats