Skip to main content

Cache

Trait Cache 

Source
pub trait Cache: Send + Sync {
    // Required methods
    fn set_nx_px(
        &self,
        key: &[u8],
        value: &[u8],
        ttl: Duration,
    ) -> impl Future<Output = Result<bool>> + Send;
    fn set(
        &self,
        key: &[u8],
        value: &[u8],
        ttl: Duration,
    ) -> impl Future<Output = Result<()>> + Send;
    fn get(
        &self,
        key: &[u8],
    ) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send;
    fn del(&self, key: &[u8]) -> impl Future<Output = Result<()>> + Send;
}

Required Methods§

Source

fn set_nx_px( &self, key: &[u8], value: &[u8], ttl: Duration, ) -> impl Future<Output = Result<bool>> + Send

Source

fn set( &self, key: &[u8], value: &[u8], ttl: Duration, ) -> impl Future<Output = Result<()>> + Send

Source

fn get( &self, key: &[u8], ) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send

Source

fn del(&self, key: &[u8]) -> impl Future<Output = Result<()>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§