karlseguin / ccache

A golang LRU Cache for high concurrency
MIT License
1.28k stars 119 forks source link

Statistics/metrics reporting #12

Open oakad opened 6 years ago

oakad commented 6 years ago

For longer running caches it is critically important to be able to obtain operational metrics - number of cached items, rate of eviction, possibly some internal statistics. All decent caches thus provide a method to unintrusively obtain those in run-time.

Ccache should have something like that to be trusted in most production settings.

karlseguin commented 6 years ago

I think you're right, but I haven't done Go in a while and don't have time to tackle this. I might come back to Go if generics are added. I'd be willing to review and merge a PR, but I think a better solution might be to wrap the calls into a statistics tracker which does what you want; although I realize you'll be limited in what you can track without access to internals.

FWIW, while I still like ccache's core lru implementation, I think it grew too fat, trying to do too much. Layered caching, tracking, ... blah.

oakad commented 6 years ago

What a pity.

Whatever the shortcomings may be, ccache is the most decent cache available in Go. Alas, the alternatives are barely usable, feature-wise.

karlseguin commented 4 years ago

I know it's late. But you can now use GetDropped to get the rate of eviction. Will keep this open since there's obviously more that could be done.