pub struct TaggedCache<B, R>where
B: CacheBackend,
R: TagRegistry,{ /* private fields */ }Expand description
Cache backend wrapper that adds tagging support
Implementations§
Source§impl<B, R> TaggedCache<B, R>where
B: CacheBackend,
R: TagRegistry,
impl<B, R> TaggedCache<B, R>where
B: CacheBackend,
R: TagRegistry,
pub fn new(backend: B, registry: R) -> Self
Put a value in cache with tags
Sourcepub async fn forget_by_tag(&self, tag: &str) -> CacheResult<Vec<String>>
pub async fn forget_by_tag(&self, tag: &str) -> CacheResult<Vec<String>>
Forget keys by tag
Forget keys by multiple tags (union)
Sourcepub async fn keys_by_tag(&self, tag: &str) -> CacheResult<Vec<String>>
pub async fn keys_by_tag(&self, tag: &str) -> CacheResult<Vec<String>>
Get keys associated with a tag
Get tags for a key
Sourcepub async fn tag_existing(&self, key: &str, tags: &[&str]) -> CacheResult<()>
pub async fn tag_existing(&self, key: &str, tags: &[&str]) -> CacheResult<()>
Tag an existing cache key
Sourcepub async fn untag(&self, key: &str, tags: &[&str]) -> CacheResult<()>
pub async fn untag(&self, key: &str, tags: &[&str]) -> CacheResult<()>
Remove tags from an existing key
Sourcepub async fn tagged_stats(&self) -> CacheResult<TaggedCacheStats>
pub async fn tagged_stats(&self) -> CacheResult<TaggedCacheStats>
Get cache statistics with tag information
Trait Implementations§
Source§impl<B, R> CacheBackend for TaggedCache<B, R>where
B: CacheBackend,
R: TagRegistry,
impl<B, R> CacheBackend for TaggedCache<B, R>where
B: CacheBackend,
R: TagRegistry,
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a value from the cache
Source§fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Put a value in the cache with optional TTL
Source§fn forget<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn forget<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove a value from the cache
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = CacheResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a key exists in the cache
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all entries from the cache
Source§fn get_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = CacheResult<Vec<Option<Vec<u8>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = CacheResult<Vec<Option<Vec<u8>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get multiple values at once (optional optimization)
Source§fn put_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [(&'life2 str, Vec<u8>, Option<Duration>)],
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
entries: &'life1 [(&'life2 str, Vec<u8>, Option<Duration>)],
) -> Pin<Box<dyn Future<Output = CacheResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Put multiple values at once (optional optimization)
Source§fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheResult<CacheStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = CacheResult<CacheStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get cache statistics (if supported)
Source§fn forget_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = CacheResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forget_many<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
keys: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = CacheResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove multiple values from the cache (optional optimization)
Auto Trait Implementations§
impl<B, R> Freeze for TaggedCache<B, R>
impl<B, R> RefUnwindSafe for TaggedCache<B, R>where
B: RefUnwindSafe,
R: RefUnwindSafe,
impl<B, R> Send for TaggedCache<B, R>
impl<B, R> Sync for TaggedCache<B, R>
impl<B, R> Unpin for TaggedCache<B, R>
impl<B, R> UnwindSafe for TaggedCache<B, R>where
B: UnwindSafe,
R: UnwindSafe,
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