Struct cache::Cache [] [src]

pub struct Cache<K> { /* fields omitted */ }

A thread-safe concurrent cache from key K to arbitrarily typed values

Methods

impl<K: Hash + Eq> Cache<K>
[src]

[src]

Create a new cache setting page size and number of pages.

page_size determines the maximum size of values that can be stored in the cache.

num pages determines how many slabs of memory of this size should be allocated.

Each page has its own read-write lock, so the more pages you have, the less likely you are to have lock contention.

[src]

Insert a value V into cache with key K, returns a Reference to the newly stored or spilled value

NOTE If you insert different values under the same key, you will only get one of them out again. Updates are not possible.

[src]

Is this value in the cache?

Trait Implementations

impl<K> Send for Cache<K>
[src]

impl<K> Sync for Cache<K>
[src]