Skip to main content

Cache

Trait Cache 

Source
pub trait Cache: Send + Sync {
    // Required methods
    fn contains(&self, key: &str) -> bool;
    fn insert(&self, key: String, value: Vec<u8>);
    fn get(&self, key: &str) -> Option<Vec<u8>>;
}
Expand description

Minimal read/write interface required by the prefetcher.

Implementors must be Send + Sync so the prefetcher can issue async-style warm operations from background contexts.

Required Methods§

Source

fn contains(&self, key: &str) -> bool

Return true if key is currently present in the cache.

Source

fn insert(&self, key: String, value: Vec<u8>)

Insert (key, value) into the cache.

Source

fn get(&self, key: &str) -> Option<Vec<u8>>

Return the value for key, or None if absent.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§