Struct headless_lms_utils::cache::Cache
source · pub struct Cache {
client: Client,
}
Expand description
Wrapper for accessing a redis cache.
Fields§
§client: Client
Implementations§
source§impl Cache
impl Cache
sourcepub async fn cache_json<V>(
&self,
key: impl ToRedisArgs + Send + Sync,
value: &V,
expires_in: Duration
) -> boolwhere
V: Serialize,
pub async fn cache_json<V>(
&self,
key: impl ToRedisArgs + Send + Sync,
value: &V,
expires_in: Duration
) -> boolwhere
V: Serialize,
Stores the given value in the redis cache as JSON (Vec<u8>
).
sourcepub async fn get_json<V>(
&self,
key: impl ToRedisArgs + Send + Sync
) -> Option<V>where
V: DeserializeOwned,
pub async fn get_json<V>(
&self,
key: impl ToRedisArgs + Send + Sync
) -> Option<V>where
V: DeserializeOwned,
Retrieves and deserializes the corresponding value for the key stored with cache_json
.
Auto Trait Implementations§
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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