Cache

Trait Cache 

Source
pub trait Cache<T: Clone> {
    // Required methods
    fn get_or_compute(&self, key: PlainRef, compute: impl FnOnce() -> T) -> T;
    fn clear(&self);
}

Required Methods§

Source

fn get_or_compute(&self, key: PlainRef, compute: impl FnOnce() -> T) -> T

Source

fn clear(&self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Clone + ValueSize + Send + 'static> Cache<T> for Arc<SyncCache<PlainRef, T>>

Available on crate feature cache only.
Source§

fn get_or_compute(&self, key: PlainRef, compute: impl FnOnce() -> T) -> T

Source§

fn clear(&self)

Implementors§

Source§

impl<T: Clone> Cache<T> for NoCache