evictor
A least-recently-used (LRU) cache implementation.
Usage
Basic Example
use NonZeroUsize;
use Lru;
let mut cache = new;
// Insert entries
cache.insert;
cache.insert;
cache.insert;
// Access entry (marks as recently used)
cache.get;
// Insert when full evicts least recently used
cache.insert;
assert!; // 2 was evicted
// Peek doesn't affect LRU order
cache.peek;
let = cache.oldest.unwrap;
assert_eq!;
Creating from Iterator
This will set the capacity to the number of items in the iterator.
use Lru;
let items = vec!;
let cache: = items.into_iter.collect;
Features
Default Features
ahash- Fast hashing using theahashcrate (enabled by default)
License
This project is licensed under the either the APACHE or MIT License at your option. See the LICENSE-APACHE and LICENSE-MIT files for details.