Struct uluru::LRUCache [] [src]

pub struct LRUCache<A: Array> { /* fields omitted */ }

A LRU cache using a statically-sized array for storage.

LRUCache uses a fixed-capacity array for storage. It provides O(1) insertion, and O(n) lookup.

All items are stored inline within the LRUCache, so it does not impose any heap allocation or indirection. A linked list is used to record the cache order, so the items themselves do not need to be moved when the order changes. (This is important for speed if the items are large.)

Methods

impl<T, A: Array<Item = Entry<T>>> LRUCache<A>
[src]

[src]

Returns the number of elements in the cache.

[src]

Touch a given entry, putting it first in the list.

[src]

Returns the front entry in the list (most recently used).

[src]

Returns a mutable reference to the front entry in the list (most recently used).

Important traits for LRUCacheIterator<'a, A>
[src]

Iterate over the contents of this cache, from more to less recently used.

Important traits for LRUCacheMutIterator<'a, A>
[src]

Iterate mutably over the contents of this cache.

[src]

Performs a lookup on the cache with the given test routine. Touches the result on a hit.

[src]

Returns the first item in the cache that matches the given predicate. Touches the result on a hit.

[src]

Insert a given key in the cache.

This item becomes the front (most-recently-used) item in the cache. If the cache is full, the back (least-recently-used) item will be removed.

[src]

Evict all elements from the cache.

Trait Implementations

impl<A: Array> Default for LRUCache<A>
[src]

[src]

Returns the "default value" for a type. Read more