[][src]Struct cached::stores::TimedSizedCache

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

Timed LRU Cache

Stores a limited number of values, evicting expired and least-used entries. Time expiration is determined based on entry insertion time.. The TTL of an entry is not updated when retrieved.

Note: This cache is in-memory only

Implementations

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

pub fn with_size_and_lifespan(
    size: usize,
    seconds: u64
) -> TimedSizedCache<K, V>
[src]

Creates a new SizedCache with a given size limit and pre-allocated backing data

pub fn key_order(&self) -> impl Iterator<Item = &K>[src]

Return an iterator of keys in the current order from most to least recently used. Items passed their expiration seconds will be excluded.

pub fn value_order(&self) -> impl Iterator<Item = &(Instant, V)>[src]

Return an iterator of timestamped values in the current order from most to least recently used. Items passed their expiration seconds will be excluded.

Trait Implementations

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

impl<K, V> CachedAsync<K, V> for TimedSizedCache<K, V> where
    K: Hash + Eq + Clone + Send
[src]

impl<K: Clone, V: Clone> Clone for TimedSizedCache<K, V>[src]

impl<K: Debug, V: Debug> Debug for TimedSizedCache<K, V>[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for TimedSizedCache<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for TimedSizedCache<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for TimedSizedCache<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for TimedSizedCache<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for TimedSizedCache<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

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.