Skip to main content

CacheStorage

Trait CacheStorage 

Source
pub trait CacheStorage: Storage {
    // Required methods
    fn ttl<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<i64>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn expire<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
        ttl_seconds: i64,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn persist<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn increment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
        delta: i64,
    ) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn decrement<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        table: &'life1 str,
        key: &'life2 str,
        delta: i64,
    ) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn cache_stats<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<CacheStats>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Cache-specific operations (for Redis)

Required Methods§

Source

fn ttl<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = StorageResult<Option<i64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get TTL for a key (seconds remaining)

Source

fn expire<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, ttl_seconds: i64, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set expiration time for a key

Source

fn persist<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove expiration from a key

Source

fn increment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, delta: i64, ) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Increment a numeric value atomically

Source

fn decrement<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 str, key: &'life2 str, delta: i64, ) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Decrement a numeric value atomically

Source

fn cache_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = StorageResult<CacheStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get cache statistics

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§