Struct dynamic_lru_cache::DynamicCacheLocal [−][src]
pub struct DynamicCacheLocal<K, V, S = RandomState> { /* fields omitted */ }Expand description
A cache that will only hold onto items that have been reqeuested more than once in recent memory. Single-use items are not held at all. Once an item is requested twice, it is cached until all memory of seeing it requested has expired. The length of the memory is adjustable, and must be set at initialization.
Implementations
Create and initialize a new cache, using the given hash builder to hash keys. The same
warnings given for HashMap::with_hasher apply here.
Fetch an item via the cache, potentially filling in the cache on a miss via the function
f.
Change the length of the cache’s recent request memory. Some contents of the cache may be removed immediately if the new memory length is shorter than the old memory length.
Clear out all stored values and all memory in the cache.
Reset the cache hit/miss metrics.