Add take_dropped to lazy_lru as a template parameter#3
Conversation
0a201ee to
b1b6e47
Compare
|
I will take a look, but on a cursory initial look:
|
|
i'm using the LRU for dedup purposes, to reduce the number of events sent. once an event gets dropped from the LRU i want to pick it up and send it. the events that remain in the LRU are drained every interval. |
|
The performance concern here is valid, this implementation will allocate a vector every time the eviction happens, which will make the impact of latency spikes ( I think it could return an As for use-cases for such API, there could be many - we gather stats in the cache value or we need to do some some extra work / finalization for dropped values. In general if the implementation of some API removes a series of elements, it is nice to allow obtaining those elements back somewhere through that or supplementing API. |
Hi @behzadnouri, I really like
lazy_lrubut I need a way to obtain the dropped elements. The "main"LruCacheimpl allows you to get the dropped value upon insert, but your crate doesn't. I addedput_with_evicted()which does the trick