Distribucache Stats
Library to assist with gathering Distribucache usage statistics, such as the hit / miss ratios and the time it takes to perform certain operations.
Note: This is a simple implementation (a starting point) that may not collect all of the data-points you may need (e.g., no percentiles, only averages). If you have suggestions or specific needs, please add them to issues (and / or PR).
Usage
;;; const cacheClient = distribucache;const collector = stats; ; const cache = cacheClient;cache;
API
createCollector(cacheClient)
returns Collector
Collector
-
getCounts()
returns an array of objects where the keys are the events and the values are how many times the events were called, for example:[{set: 58, populate: 58, get: 58, get_miss: 58, nsp: 'n'}]
-
getDurations()
returns an array of objects where the keys are the events and the values are how long (in ms) it took for the event to finish. The results are algebraically averaged based on the counts from the lastreset()
. For example:[{set: 0, populate: 103, get: 0, nsp: 'n'}
-
reset()
resets the counts and the durations
Note: the nsp
is the cache namespace
.