Crate lru_time_cache [−] [src]
Least Recently Used (LRU) Cache
Implementation of a Least Recently Used caching algorithm in a container which may be limited by size or time, ordered by most recently seen.
Examples
extern crate lru_time_cache; extern crate time; use ::lru_time_cache::LruCache; // Construct an `LruCache` of `<u8, String>`s, limited by key count let max_count = 10; let lru_cache = LruCache::<u8, String>::with_capacity(max_count); // Construct an `LruCache` of `<String, i64>`s, limited by expiry time let time_to_live = ::time::Duration::milliseconds(100); let lru_cache = LruCache::<String, i64>::with_expiry_duration(time_to_live); // Construct an `LruCache` of `<u64, Vec<u8>>`s, limited by key count and expiry time let lru_cache = LruCache::<u64, Vec<u8>>::with_expiry_duration_and_capacity(time_to_live, max_count);
Structs
LruCache |
Implementation of LRU cache. |
OccupiedEntry |
An occupied Entry. |
VacantEntry |
A vacant Entry. |
Enums
Entry |
A view into a single entry in an LRU cache, which may either be vacant or occupied. |