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§async fn get(&self, key: &str) -> Result<Option<CacheRead>, CacheError>
async fn get(&self, key: &str) -> Result<Option<CacheRead>, CacheError>
Fetches a cached entry by key. Read more
Source§async fn set(
&self,
key: String,
entry: CacheEntry,
ttl: Duration,
stale_for: Duration,
) -> Result<(), CacheError>
async fn set( &self, key: String, entry: CacheEntry, ttl: Duration, stale_for: Duration, ) -> Result<(), CacheError>
Stores an entry with a time-to-live and additional stale window.
Source§async fn invalidate(&self, key: &str) -> Result<(), CacheError>
async fn invalidate(&self, key: &str) -> Result<(), CacheError>
Invalidates the cache entry for
key, if present.Source§async fn get_keys_by_tag(&self, tag: &str) -> Result<Vec<String>, CacheError>
async fn get_keys_by_tag(&self, tag: &str) -> Result<Vec<String>, CacheError>
Retrieves all cache keys associated with a tag. Read more
Lists all currently indexed tags. Read more
Source§fn invalidate_by_tag(
&self,
tag: &str,
) -> impl Future<Output = Result<usize, CacheError>> + Send
fn invalidate_by_tag( &self, tag: &str, ) -> impl Future<Output = Result<usize, CacheError>> + Send
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 (const: unstable) · 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 !RefUnwindSafe for InMemoryBackend
impl !UnwindSafe for InMemoryBackend
impl Freeze for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl UnsafeUnpin 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