pub struct MokaCacheProvider { /* private fields */ }Expand description
Nidus provider wrapping a Moka local in-memory cache.
Implementations§
Source§impl MokaCacheProvider
impl MokaCacheProvider
Sourcepub fn builder() -> MokaCacheBuilder
pub fn builder() -> MokaCacheBuilder
Creates a Moka cache provider builder.
Sourcepub fn from_cache(
cache: Cache<String, Vec<u8>>,
namespace: Option<String>,
) -> Self
pub fn from_cache( cache: Cache<String, Vec<u8>>, namespace: Option<String>, ) -> Self
Creates a provider from an existing Moka cache and optional namespace.
Sourcepub async fn insert(&self, key: impl AsRef<str>, value: Vec<u8>)
pub async fn insert(&self, key: impl AsRef<str>, value: Vec<u8>)
Inserts a value by logical key.
Sourcepub async fn get(&self, key: impl AsRef<str>) -> Option<Vec<u8>>
pub async fn get(&self, key: impl AsRef<str>) -> Option<Vec<u8>>
Returns a value by logical key.
Sourcepub async fn invalidate(&self, key: impl AsRef<str>)
pub async fn invalidate(&self, key: impl AsRef<str>)
Invalidates a value by logical key.
Trait Implementations§
Source§impl Clone for MokaCacheProvider
impl Clone for MokaCacheProvider
Source§fn clone(&self) -> MokaCacheProvider
fn clone(&self) -> MokaCacheProvider
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 moreSource§impl Debug for MokaCacheProvider
impl Debug for MokaCacheProvider
Source§impl ProviderRegistrant for MokaCacheProvider
impl ProviderRegistrant for MokaCacheProvider
Source§fn register_provider(container: &mut Container) -> NidusResult<()>
fn register_provider(container: &mut Container) -> NidusResult<()>
Registers this provider type.
Auto Trait Implementations§
impl !RefUnwindSafe for MokaCacheProvider
impl !UnwindSafe for MokaCacheProvider
impl Freeze for MokaCacheProvider
impl Send for MokaCacheProvider
impl Sync for MokaCacheProvider
impl Unpin for MokaCacheProvider
impl UnsafeUnpin for MokaCacheProvider
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