pub struct MokaCache { /* private fields */ }Expand description
Moka in-memory cache with per-key TTL support
Implementations§
Source§impl MokaCache
impl MokaCache
Sourcepub fn new(config: MokaCacheConfig) -> Result<Self>
pub fn new(config: MokaCacheConfig) -> Result<Self>
Trait Implementations§
Source§impl CacheBackend for MokaCache
Implement CacheBackend trait for MokaCache
impl CacheBackend for MokaCache
Implement CacheBackend trait for MokaCache
Source§fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
fn get<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Option<Bytes>>
Get value from cache by key Read more
Source§fn set_with_ttl<'a>(
&'a self,
key: &'a str,
value: Bytes,
ttl: Duration,
) -> BoxFuture<'a, Result<()>>
fn set_with_ttl<'a>( &'a self, key: &'a str, value: Bytes, ttl: Duration, ) -> BoxFuture<'a, Result<()>>
Set value in cache with time-to-live Read more
Source§fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<()>>
fn remove<'a>(&'a self, key: &'a str) -> BoxFuture<'a, Result<()>>
Remove value from cache Read more
Auto Trait Implementations§
impl Freeze for MokaCache
impl !RefUnwindSafe for MokaCache
impl Send for MokaCache
impl Sync for MokaCache
impl Unpin for MokaCache
impl UnsafeUnpin for MokaCache
impl !UnwindSafe for MokaCache
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