Cache hit/miss metrics
🏗 Enhancement Proposal
Have cache manager keep a count of cache hit/misses during use.
Pitch
Something that popped into my head while testing for #179, it would be useful for the cache manager to store cache hit/miss counts. This would allow app developers to better understand how the cache is performing, and adjust usage to improve cache hit rates.
Platforms affected (mark all that apply)
- [x] :iphone: iOS
- [x] :robot: Android
That could be interesting, but I think the cache should also keep track if it used to have a file and why it is deleted when it is deleted. Only knowing if a file is in cache or not is not as useful as knowing that a file used to be in the cache but removed because it was too old or it had never been in the cache.
Actually thinking about it more a simple access counter on each cache record would be all that's needed for counting cache hits, misses is simply the number of items in the cache.
But for other things, maybe the cache could publish events (like removal) to a stream for consumption elsewhere? Storing this kind of data could cause problems, because the cache database would continue to grow even as files are removed, but for measurement, a stream of events would be useful, maybe?