[][src]Struct lightspeed_cache::Cache

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

Methods

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

pub fn new(ttl_seconds: u32) -> Self[src]

pub fn get(&self, key: &K) -> Option<Arc<V>>[src]

pub async fn get_or_insert_with<'_, F: FnOnce() -> Fut, Fut: Future<Output = V>>(
    &'_ self,
    key: K,
    default: F
) -> Arc<V>
[src]

pub async fn get_or_try_insert_with<'_, F: FnOnce() -> Fut, Fut: Future<Output = Result<V, E>>, E>(
    &'_ self,
    key: K,
    default: F
) -> Result<Arc<V>, E>
[src]

pub fn insert(&self, key: K, value: V)[src]

pub fn remove(&self, key: &K)[src]

Trait Implementations

impl<K: Hash + Eq, V> Clone for Cache<K, V>[src]

Auto Trait Implementations

impl<K, V> !RefUnwindSafe for Cache<K, V>

impl<K, V> Send for Cache<K, V> where
    K: Send + Sync,
    V: Send + Sync

impl<K, V> Sync for Cache<K, V> where
    K: Send + Sync,
    V: Send + Sync

impl<K, V> Unpin for Cache<K, V>

impl<K, V> !UnwindSafe for Cache<K, V>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.