Closed dotcypress closed 3 years ago
Traversing the list could be done more efficiently by providing an iterator, like in some older versions of this crate:
https://docs.rs/uluru/0.2.0/uluru/struct.LRUCache.html#method.iter
Would this work for your use case?
Ah, it looks like you need to go both backward and forward, so an iterator alone won't work. This seems fine.
This has been published in uluru 2.1.0.
I also added a .iter()
method, so cache.get(i)
is now equivalent to cache.iter().nth(i)
.
Awesome! Thank you @mbrubeck for quick response!
New method added to access item in LRU list by index.
This feature is useful for traverse list in least-recently-used order.