pub struct MemoryLruCache<K, V> { /* private fields */ }
Expand description

An LRU-cache which operates on memory used.

Implementations§

Create a new cache with a maximum cumulative size of values.

Insert an item.

Get a reference to an item in the cache. It is a logic error for its heap size to be altered while borrowed.

Execute a closure with the value under the provided key.

Currently-used size of values in bytes.

Returns the number of key-value pairs that are currently in the cache.

Returns a bool indicating whether the given key is in the cache. Does not update the LRU list.

Returns a bool indicating whether the cache is empty or not.

Returns a reference to the value corresponding to the key in the cache or None if it is not present in the cache. Unlike get, peek does not update the LRU list so the key’s position will be unchanged.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.