Package ortus.boxlang.runtime.cache.util
Class BoxCacheStats
java.lang.Object
ortus.boxlang.runtime.cache.util.BoxCacheStats
- All Implemented Interfaces:
ICacheStats
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGet the total cache's evictions due to cache constraints (e.g.intHow many entries are expired in the cache.longGet the total cache's garbage collections of Soft/Weak referencesinthitRate()Get the cache's hit rate = hits / (hits + misses)longhits()Get the total cache's hitsGet the date/time of the last reap the cache didlongmisses()Get the total cache's missesintHow many entries are in the cache.longHow many times the cache has been reapedRecord an eviction hitRecord a cache garbage collectionRecord a cache hitRecord a cache missRecord a cache reapreset()Reset the cache's statisticslongsize()Get the total cache's size in bytesstarted()When the cache was startedtoStruct()Get a Struct representation of the cache's statistics
-
Constructor Details
-
BoxCacheStats
public BoxCacheStats()Constructor
-
-
Method Details
-
recordEviction
Record an eviction hit- Specified by:
recordEvictionin interfaceICacheStats
-
recordHit
Record a cache hit- Specified by:
recordHitin interfaceICacheStats
-
recordMiss
Record a cache miss- Specified by:
recordMissin interfaceICacheStats
-
recordGCHit
Record a cache garbage collection- Specified by:
recordGCHitin interfaceICacheStats
-
recordReap
Record a cache reap- Specified by:
recordReapin interfaceICacheStats
-
hitRate
public int hitRate()Get the cache's hit rate = hits / (hits + misses)- Specified by:
hitRatein interfaceICacheStats- 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:
objectCountin interfaceICacheStats- 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:
expiredCountin interfaceICacheStats- Returns:
- The expired count
-
reset
Reset the cache's statistics- Specified by:
resetin interfaceICacheStats- Returns:
- The stats object
-
garbageCollections
public long garbageCollections()Get the total cache's garbage collections of Soft/Weak references- Specified by:
garbageCollectionsin interfaceICacheStats- 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:
evictionCountin interfaceICacheStats- Returns:
- The eviction count
-
hits
public long hits()Get the total cache's hits- Specified by:
hitsin interfaceICacheStats- Returns:
- The hits
-
misses
public long misses()Get the total cache's misses- Specified by:
missesin interfaceICacheStats- Returns:
- The misses
-
lastReapDatetime
Get the date/time of the last reap the cache did- Specified by:
lastReapDatetimein interfaceICacheStats- Returns:
- date/time or null if never reaped
-
reapCount
public long reapCount()How many times the cache has been reaped- Specified by:
reapCountin interfaceICacheStats- Returns:
- The reap count
-
started
When the cache was started- Specified by:
startedin interfaceICacheStats
-
size
public long size()Get the total cache's size in bytes- Specified by:
sizein interfaceICacheStats- Returns:
- The size in bytes
-
toStruct
Get a Struct representation of the cache's statistics- Specified by:
toStructin interfaceICacheStats
-