pub struct Cache {
pub client: Client,
}Fields§
§client: ClientImplementations§
Source§impl Cache
impl Cache
pub async fn new(config: &Config) -> Result<Self, Error>
pub async fn cache_data<T>(
&self,
key: &str,
data: &T,
ttl: u64,
) -> Result<(), RedisError>where
T: Cacheable,
pub async fn get_cached_data<T>(
&self,
key: &str,
) -> Result<Option<T>, RedisError>where
T: Cacheable,
pub async fn cache_or_fetch<T, F, Fut>( &self, key: &str, ttl: u64, fetch_fn: F, ) -> Result<T, RedisError>
pub async fn cache_with_key<K, T>( &self, key: K, data: &T, ttl: u64, ) -> Result<(), RedisError>
pub async fn get_with_key<K, T>(&self, key: K) -> Result<Option<T>, RedisError>
pub async fn delete_cached_data(&self, key: &str) -> Result<(), RedisError>
pub async fn cache_rooms( &self, rooms: &Vec<PublicRoom>, ttl: u64, ) -> Result<(), RedisError>
pub async fn get_cached_rooms(&self) -> Result<Vec<PublicRoom>, RedisError>
pub async fn get_cached_room_state( &self, room_id: &str, ) -> Result<Vec<PublicRoom>, RedisError>
pub async fn cache_public_spaces( &self, rooms: &Vec<RoomSummary>, ttl: u64, ) -> Result<(), RedisError>
pub async fn get_cached_public_spaces( &self, ) -> Result<Vec<RoomSummary>, RedisError>
pub async fn cache_room_state( &self, room_id: &str, state: &Vec<PublicRoom>, ttl: u64, ) -> Result<(), RedisError>
pub async fn cache_proxy_response( &self, key: &str, data: &[u8], ttl: u64, ) -> Result<(), RedisError>
pub async fn get_cached_proxy_response( &self, key: &str, ) -> Result<Vec<u8>, RedisError>
pub async fn cache_multiple<T>(
&self,
items: Vec<(&str, &T, u64)>,
) -> Result<(), RedisError>where
T: Cacheable,
pub async fn delete_multiple(&self, keys: &[&str]) -> Result<(), RedisError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
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