# Struct ethcore_util::cache::MemoryLruCache [−] [src]

    pub struct MemoryLruCache<K: Eq + Hash, V: HeapSizeOf> { /* fields omitted */ }

An LRU-cache which operates on memory used.

## Methods

### `impl<K: Eq + Hash, V: HeapSizeOf> MemoryLruCache<K, V>`
[src]

#### `fn new(max_size: usize) -> Self`

Create a new cache with a maximum size in bytes.

#### `fn insert(&mut self, key: K, val: V)`

Insert an item.

#### `fn get_mut(&mut self, key: &K) -> Option<&mut V>`

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

#### `fn current_size(&self) -> usize`

Currently-used size of values in bytes.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)