Struct reactor_cache::ReactorCache [] [src]

pub struct ReactorCache<K, V, E> { /* fields omitted */ }

Methods

impl<K: Clone + Eq + Hash, V: Weighted, E: Clone + Debug> ReactorCache<K, V, E>
[src]

Core methods for interacting with the cache

Creates a new Reactor Cache with the given capacity, which runs in handle's event-loop

Returns a future with a snapshot of the cache's stats. No guarnatees are made about when the snapshot is taken.

Example

Run a future that logs the cache stats:

    let mut core = Core::new().expect("meltdown");
    let cache = ReactorCache::<Int, Int, ()>::new(10, core.handle());
    core.run(cache.stats().map(|s| println!("{:?}",s))).unwrap();

Returns a future with a snapshot of the cache's stats. No guarnatees are made about when the snapshot is taken.

Example

Run a future that logs the cache stats:

    let mut core = Core::new().expect("meltdown");
    let cache = ReactorCache::<Int, Int, ()>::new(10, core.handle());
    core.run(cache.load_fn(Int(1), ||
    core.run(cache.stats().map(|s| println!("{:?}",s))).unwrap();