Expand description
This crate provides a generic, fixed-size, N-way associative cache data structure that supports random and least recently used replacement (or your own custom algorithm).
Dive into the documentation for
AssociativeCache
to begin.
Re-exports§
pub use capacity::*;
pub use entry::*;
pub use indices::*;
pub use iter::*;
pub use replacement::*;
Modules§
- capacity
- Constant cache capacity implementations.
- entry
- An API for get-or-create operations on cache entries, similar to
std::collections::HashMap
’s entry API. - indices
- Various kinds of associativity and
Indices
implementations. - iter
- Various iterator implementations and type definitions for
AssociativeCache
. - replacement
- Implementations of various replacement algorithms used when inserting into a full cache.
Structs§
- Associative
Cache - A fixed-size associative cache mapping
K
keys toV
values.
Traits§
- Capacity
- A constant cache capacity.
- Indices
- Given a cache key, return all the slots within the cache where its entry might be.
- Replacement
- Given that we need to replace a cache entry when inserting a new one, consider
each
(index, entry)
pair and return the index whose entry should be replaced.