type-cacheable
type-cacheable copied to clipboard
Cache hit / miss rate
Love this library!
At the moment there appears to be no hooks to determine if the cached key lookup was a hit or a miss or the number of times a key has been accessed ? Any thoughts on an interface to view these stats?
Thanks!
Could you provide me with the stats you'd find helpful?
hits: 10,
misses: 5,
Do you need more information to be stored? For example:
hits: {
methodName: 10,
},
misses: {
methodName: 5,
},
Or even more, down to the key name?
To start with overall and by method but eventually by key would also be useful.
I'm not sure if this would be possible but in addition to counts for hits and misses, a request rate per second?
eg Overall
summary: {
hits: {
rate: 0.5,
count: 100,
},
misses: {
rate: 0.1,
count: 20
},
}
If you look at node-cache
https://github.com/ptarjan/node-cache/blob/master/index.js
It exposes a simple .hits() and .misses() method that's only populated when running with a debug flag.