Closed costela closed 2 months ago
Hello @costela I'm pleased to see your contribution 🙇
I think that adding a parameter to the function seems fine.
type OnEvictCallback[K comparable, V any] func(key K, value V, expired bool)
The name expired is arbitrarily chosen by me, please suggest a name that makes sense more.
A first pass is at https://github.com/scalalang2/golang-fifo/pull/37
PTAL :pray:
Thank you for your work. Once it's merged, I'll tag it with a new release 👍
Currently, the
OnEvictCallback
callback is called for evictions - as expected - but also for expirations (based on TTL) and manual removals.Further, the current
OnEvictCallback
signature does not allow differentiate which of these cases happened.I propose making a breaking change and either:
OnEvictCallback
Any of these seem acceptable? If yes, I'd cook up a PR.