FastCache icon indicating copy to clipboard operation
FastCache copied to clipboard

Feature request: PostEvictionCallback

Open ruslan528 opened this issue 2 years ago • 3 comments

In common scenarios developer want to log eviction from cache. This is an important feature to improve observability of application. I propose to add new optional parameter to constructor - delegate (see Microsoft.Extensions.Caching.Memory.PostEvictionDelegate).

ruslan528 avatar Aug 29 '23 14:08 ruslan528

Thanks!

Do you mean one call back for every item, or cache-global?

alex-jitbit avatar Aug 31 '23 10:08 alex-jitbit

I think that "cache-global" implementation will be enough. That universal "PostEvictionDelegate" will receive evicted item - so we will have ability to log his key and value.

ruslan528 avatar Aug 31 '23 13:08 ruslan528

+1

licentia88 avatar Sep 25 '24 11:09 licentia88