pub struct MultiTierBackend<L1, L2> { /* private fields */ }Expand description
Multi-tier cache backend combining fast L1 and persistent L2.
The multi-tier backend automatically promotes frequently accessed entries from L2 to L1 based on the configured promotion strategy.
Implementations§
Source§impl<L1, L2> MultiTierBackend<L1, L2>where
L1: CacheBackend,
L2: CacheBackend,
impl<L1, L2> MultiTierBackend<L1, L2>where
L1: CacheBackend,
L2: CacheBackend,
Sourcepub fn new(l1: L1, l2: L2) -> Self
pub fn new(l1: L1, l2: L2) -> Self
Creates a new multi-tier backend with default configuration.
Sourcepub fn builder() -> MultiTierBuilder<L1, L2>
pub fn builder() -> MultiTierBuilder<L1, L2>
Creates a builder for configuring the multi-tier backend.
Trait Implementations§
Source§impl<L1, L2> CacheBackend for MultiTierBackend<L1, L2>where
L1: CacheBackend,
L2: CacheBackend,
impl<L1, L2> CacheBackend for MultiTierBackend<L1, L2>where
L1: CacheBackend,
L2: CacheBackend,
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheRead>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<CacheRead>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches a cached entry by key. Read more
Source§fn set<'life0, 'async_trait>(
&'life0 self,
key: String,
entry: CacheEntry,
ttl: Duration,
stale_for: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
key: String,
entry: CacheEntry,
ttl: Duration,
stale_for: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stores an entry with a time-to-live and additional stale window.
Source§fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invalidates the cache entry for
key, if present.Source§fn get_keys_by_tag<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_keys_by_tag<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves all cache keys associated with a tag. Read more
Source§fn invalidate_by_tag<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate_by_tag<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invalidates all cache entries associated with a tag. Read more
Lists all currently indexed tags. Read more
Invalidates all cache entries associated with multiple tags. Read more
Source§impl<L1: Clone, L2: Clone> Clone for MultiTierBackend<L1, L2>
impl<L1: Clone, L2: Clone> Clone for MultiTierBackend<L1, L2>
Source§fn clone(&self) -> MultiTierBackend<L1, L2>
fn clone(&self) -> MultiTierBackend<L1, L2>
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<L1, L2> Freeze for MultiTierBackend<L1, L2>
impl<L1, L2> !RefUnwindSafe for MultiTierBackend<L1, L2>
impl<L1, L2> Send for MultiTierBackend<L1, L2>
impl<L1, L2> Sync for MultiTierBackend<L1, L2>
impl<L1, L2> Unpin for MultiTierBackend<L1, L2>
impl<L1, L2> !UnwindSafe for MultiTierBackend<L1, L2>
Blanket Implementations§
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