Skip to main content

ICacheService

Trait ICacheService 

Source
pub trait ICacheService: Sync + Send {
    // Required methods
    fn set_string<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
        v: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_string<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn del_string<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_string_ex<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
        v: &'life2 str,
        ex: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set_string_ex_nx<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
        v: &'life2 str,
        ex: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set_value<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
        v: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_value<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_value_ex<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
        v: &'life2 [u8],
        ex: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn ttl<'life0, 'life1, 'async_trait>(
        &'life0 self,
        k: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn set_string<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, k: &'life1 str, v: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_string<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn del_string<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn set_string_ex<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, k: &'life1 str, v: &'life2 str, ex: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn set_string_ex_nx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, k: &'life1 str, v: &'life2 str, ex: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

原子操作:仅当 key 不存在时设置值并设置过期时间 返回 true 表示设置成功(key 原本不存在),false 表示设置失败(key 已存在)

Source

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

Source

fn get_value<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn set_value_ex<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, k: &'life1 str, v: &'life2 [u8], ex: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn ttl<'life0, 'life1, 'async_trait>( &'life0 self, k: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§