Skip to main content

TaggedCacheStore

Trait TaggedCacheStore 

Source
pub trait TaggedCacheStore: Send + Sync {
    // Required methods
    fn put_tagged<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: Cow<'life2, [u8]>,
        ttl: Option<Duration>,
        tags: &'life3 [&'life4 str],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn fill_token<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<FillToken>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn fill_tagged<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        token: FillToken,
        key: &'life1 str,
        value: Cow<'life2, [u8]>,
        ttl: Option<Duration>,
        tags: &'life3 [&'life4 str],
    ) -> Pin<Box<dyn Future<Output = Result<Fill>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn invalidate_tags<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tags: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Tagged writes, fenced fills and invalidation by tag for a store that supports them.

Reached through CacheStore::tagged. These are separate entry points rather than an optional argument to put, so a store without tags refuses the tagged call instead of silently dropping its tags. Reads are the same for tagged and untagged entries. A store with tags has the fenced fill as well: without it, a value read from a source while one of its tags was invalidated could be cached with nothing left to remove it.

Required Methods§

Source

fn put_tagged<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, key: &'life1 str, value: Cow<'life2, [u8]>, ttl: Option<Duration>, tags: &'life3 [&'life4 str], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Store value under key so that Self::invalidate_tags of any of tags makes it a miss. An empty set is an untagged put. A set larger than the store keeps is Error::TooManyTags; nothing is truncated.

Source

fn fill_token<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<FillToken>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

This store’s position on its tag-invalidation clock. Take it immediately before reading the authoritative source, and before any snapshot that read uses.

Source

fn fill_tagged<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, token: FillToken, key: &'life1 str, value: Cow<'life2, [u8]>, ttl: Option<Duration>, tags: &'life3 [&'life4 str], ) -> Pin<Box<dyn Future<Output = Result<Fill>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Store value, read from the authoritative source after token was taken, under tags, unless an invalidation of one of them is newer than the token: an invalidation whose clock position is at or below the token ran before the read began and is in what it returned; one above it refuses the fill (Fill::Invalidated), whether it reaches the store before the fill or after. Arguments the store refuses are errors, as for Self::put_tagged; an empty set is an untagged fill.

Source

fn invalidate_tags<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tags: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Make every entry carrying any of tags, written before this call, a miss. An empty set is Error::TagsEmpty. Change the source first, then invalidate: a fill whose token was read after this call returns is kept.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§