Struct il2_utils::cache::SimpleCache[][src]

pub struct SimpleCache<K: Eq + Hash + Copy + Send + Sync, V: Send + Sync> { /* fields omitted */ }
Expand description

This struct implements a simple value cache that holds up to a certain number of entries at a time.

When it reaches its maximum capacity it will drop the oldest unused entries.

All methods of this struct are thread-safe.

Implementations

Creates a new SimpleCache with a given capacity.

Arguments:

  • max_size: Maximum number of items in the cache;

Trait Implementations

Gets the value from the cache if it exists. Read more

Inserts the value into the cache. Reinserting a new value with the same key will replace the existing value. Read more

Removes all entries from the cache.

Returns the number of entries in the cache.

Returns true if the cache is empty or false otherwise.

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.