jeromefroe/lru-rs

Exporting keys

rohitjoshi opened this issue · 3 comments

It would be good to have the ability to export keys so the cache can be warmup at startup.
I am using iter to get all the keys from LRU but requires an extended period of mutex lock which would impact clients.

Is there any way to export keys with minimal locking duration?

Interesting, it sounds like you could use some form of MVCC so that you could get an iterator over the keys at a certain point in time and continue to operate on the cache afterwards?

How do we achieve this?

Hi @rohitjoshi! I can't think of a better way currently than to get an iter to iterate over all the keys. To be able to get an iter at a particular snapshot which would allow future operations to continue uninterrupted would be an awesome feature, but would require a significant reworking of the internals of the cache.