Skip to main content

BaseCache

Trait BaseCache 

Source
pub trait BaseCache:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn set<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
        value: Vec<u8>,
        ttl: Option<Duration>,
    ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        namespace: &'life1 str,
        key: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn clear<'life0, 'life1, 'async_trait>(
        &'life0 self,
        namespace: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Base cache trait for checkpoint caching

Defines the interface for caching checkpoint data to reduce storage load.

Required Methods§

Source

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, namespace: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get cached data

§Errors

Returns CheckpointError::Storage if retrieval fails.

Source

fn set<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, namespace: &'life1 str, key: &'life2 str, value: Vec<u8>, ttl: Option<Duration>, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Set cached data with optional TTL

§Errors

Returns CheckpointError::Storage if storage fails.

Source

fn delete<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, namespace: &'life1 str, key: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete cached data

§Errors

Returns CheckpointError::Storage if deletion fails.

Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, namespace: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<(), CheckpointError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clear cache (optionally by namespace)

§Errors

Returns CheckpointError::Storage if clearing fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§