pub struct InMemoryBackend { /* private fields */ }Expand description
An in-memory CacheBackend implementation backed by moka.
The backend is cheap to clone and shares a single underlying cache.
Implementations§
Trait Implementations§
Source§impl CacheBackend for InMemoryBackend
impl CacheBackend for InMemoryBackend
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
Lists all currently indexed tags. 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
Invalidates all cache entries associated with multiple tags. Read more
Source§impl Clone for InMemoryBackend
impl Clone for InMemoryBackend
Source§fn clone(&self) -> InMemoryBackend
fn clone(&self) -> InMemoryBackend
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 Freeze for InMemoryBackend
impl !RefUnwindSafe for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl !UnwindSafe for InMemoryBackend
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