Package ortus.boxlang.runtime.cache.util
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 Summary
Modifier and TypeMethodDescriptionlong
Get the total cache's evictions due to cache constraints (e.g.int
How many entries are expired in the cache.long
Get the total cache's garbage collections of Soft/Weak referencesint
hitRate()
Get the cache's hit rate = hits / (hits + misses)long
hits()
Get the total cache's hitsGet the date/time of the last reap the cache didlong
misses()
Get the total cache's missesint
How many entries are in the cache.long
How 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 statisticslong
size()
Get the total cache's size in bytesstarted()
When the cache was startedtoStruct()
Get a Struct representation of the cache's statistics
-
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
-