pub struct NamespacedCache<S: CacheStore> { /* private fields */ }Expand description
Namespaced cache manager that automatically prefixes all keys.
Implementations§
Source§impl<S: CacheStore> NamespacedCache<S>
impl<S: CacheStore> NamespacedCache<S>
Sourcepub async fn get<T: DeserializeOwned>(
&self,
key: &str,
) -> CacheResult<Option<T>>
pub async fn get<T: DeserializeOwned>( &self, key: &str, ) -> CacheResult<Option<T>>
Get a typed value from the cache.
Sourcepub async fn set<T: Serialize>(
&self,
key: &str,
value: &T,
ttl: Option<Duration>,
) -> CacheResult<()>
pub async fn set<T: Serialize>( &self, key: &str, value: &T, ttl: Option<Duration>, ) -> CacheResult<()>
Set a typed value in the cache.
Sourcepub async fn delete(&self, key: &str) -> CacheResult<()>
pub async fn delete(&self, key: &str) -> CacheResult<()>
Delete a key from the cache.
Auto Trait Implementations§
impl<S> Freeze for NamespacedCache<S>
impl<S> RefUnwindSafe for NamespacedCache<S>where
S: RefUnwindSafe,
impl<S> Send for NamespacedCache<S>
impl<S> Sync for NamespacedCache<S>
impl<S> Unpin for NamespacedCache<S>
impl<S> UnsafeUnpin for NamespacedCache<S>
impl<S> UnwindSafe for NamespacedCache<S>where
S: RefUnwindSafe,
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