pub struct TieredCache<FirstCacheT, NextCacheT> {
pub first: FirstCacheT,
pub next: NextCacheT,
}
Expand description
Two-tiered Cache.
The assumption is that the first cache is faster than the next.
For more tiers you can chain this type.
Fields§
§first: FirstCacheT
First cache.
next: NextCacheT
Next cache.
Implementations§
Source§impl<FirstCacheT, NextCacheT> TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT, NextCacheT> TieredCache<FirstCacheT, NextCacheT>
Trait Implementations§
Source§impl<CacheKeyT, FirstCacheT, NextCacheT> Cache<CacheKeyT> for TieredCache<FirstCacheT, NextCacheT>
impl<CacheKeyT, FirstCacheT, NextCacheT> Cache<CacheKeyT> for TieredCache<FirstCacheT, NextCacheT>
Source§async fn get(&self, key: &CacheKeyT) -> Option<CachedResponseRef>
async fn get(&self, key: &CacheKeyT) -> Option<CachedResponseRef>
Get an entry from the cache. Read more
Source§async fn put(&self, key: CacheKeyT, cached_response: CachedResponseRef)
async fn put(&self, key: CacheKeyT, cached_response: CachedResponseRef)
Put an entry in the cache. Read more
Source§async fn invalidate(&self, key: &CacheKeyT)
async fn invalidate(&self, key: &CacheKeyT)
Invalidate a cache entry. Read more
Source§async fn invalidate_all(&self)
async fn invalidate_all(&self)
Invalidate all cache entries. Read more
Source§impl<FirstCacheT: Clone, NextCacheT: Clone> Clone for TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT: Clone, NextCacheT: Clone> Clone for TieredCache<FirstCacheT, NextCacheT>
Source§fn clone(&self) -> TieredCache<FirstCacheT, NextCacheT>
fn clone(&self) -> TieredCache<FirstCacheT, NextCacheT>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<FirstCacheT, NextCacheT> Freeze for TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT, NextCacheT> RefUnwindSafe for TieredCache<FirstCacheT, NextCacheT>where
FirstCacheT: RefUnwindSafe,
NextCacheT: RefUnwindSafe,
impl<FirstCacheT, NextCacheT> Send for TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT, NextCacheT> Sync for TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT, NextCacheT> Unpin for TieredCache<FirstCacheT, NextCacheT>
impl<FirstCacheT, NextCacheT> UnwindSafe for TieredCache<FirstCacheT, NextCacheT>where
FirstCacheT: UnwindSafe,
NextCacheT: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more