flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

Cache hit/miss metrics

Open MichaelMarner opened this issue 5 years ago • 2 comments

🏗 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

MichaelMarner avatar Jun 14 '20 01:06 MichaelMarner

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.

renefloor avatar Jun 14 '20 12:06 renefloor

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?

MichaelMarner avatar Jun 14 '20 13:06 MichaelMarner