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.

Create and initialize a new cache.

Fetch an item via the cache, potentially filling in the cache on a miss via the function f.

Get the number of items currently stored in the cache.

Get the length of the cache’s recent request memory.

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.

Get the number of hits this cache has seen.

Get the number of misses this cache has seen.

Reset the cache hit/miss metrics.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.