Struct cached::AsyncRedisCache
source · [−]pub struct AsyncRedisCache<K, V> { /* private fields */ }
Expand description
Cache store backed by redis
Values have a ttl applied and enforced by redis.
Implementations
sourceimpl<K, V> AsyncRedisCache<K, V> where
K: Display + Send + Sync,
V: Serialize + DeserializeOwned + Send + Sync,
impl<K, V> AsyncRedisCache<K, V> where
K: Display + Send + Sync,
V: Serialize + DeserializeOwned + Send + Sync,
Trait Implementations
sourceimpl<'de, K, V> IOCachedAsync<K, V> for AsyncRedisCache<K, V> where
K: Display + Send + Sync,
V: Serialize + DeserializeOwned + Send + Sync,
impl<'de, K, V> IOCachedAsync<K, V> for AsyncRedisCache<K, V> where
K: Display + Send + Sync,
V: Serialize + DeserializeOwned + Send + Sync,
sourcefn cache_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn cache_get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get a cached value
sourcefn cache_set<'life0, 'async_trait>(
&'life0 self,
key: K,
val: V
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn cache_set<'life0, 'async_trait>(
&'life0 self,
key: K,
val: V
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Set a cached value
sourcefn cache_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn cache_remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K
) -> Pin<Box<dyn Future<Output = Result<Option<V>, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Remove a cached value
sourcefn cache_set_refresh(&mut self, refresh: bool) -> bool
fn cache_set_refresh(&mut self, refresh: bool) -> bool
Set the flag to control whether cache hits refresh the ttl of cached values, returns the old flag value
sourcefn cache_lifespan(&self) -> Option<u64>
fn cache_lifespan(&self) -> Option<u64>
Return the lifespan of cached values (time to eviction)
sourcefn cache_set_lifespan(&mut self, seconds: u64) -> Option<u64>
fn cache_set_lifespan(&mut self, seconds: u64) -> Option<u64>
Set the lifespan of cached values, returns the old value
type Error = RedisCacheError
Auto Trait Implementations
impl<K, V> !RefUnwindSafe for AsyncRedisCache<K, V>
impl<K, V> Send for AsyncRedisCache<K, V> where
K: Send,
V: Send,
impl<K, V> Sync for AsyncRedisCache<K, V> where
K: Sync,
V: Sync,
impl<K, V> Unpin for AsyncRedisCache<K, V> where
K: Unpin,
V: Unpin,
impl<K, V> !UnwindSafe for AsyncRedisCache<K, V>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more