Skip to main content

CacheStore

Trait CacheStore 

Source
pub trait CacheStore: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SyncItem>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'life1, 'async_trait>(
        &'life0 self,
        item: &'life1 SyncItem,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn put_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        items: &'life1 [SyncItem],
    ) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn put_batch_with_ttl<'life0, 'life1, 'async_trait>(
        &'life0 self,
        items: &'life1 [SyncItem],
        ttl_secs: Option<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn ft_create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn ft_dropindex<'life0, 'life1, 'async_trait>(
        &'life0 self,
        index: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn ft_search<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        index: &'life1 str,
        query: &'life2 str,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn ft_search_with_params<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        index: &'life1 str,
        query: &'life2 str,
        params: &'life3 [(String, Vec<u8>)],
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SyncItem>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn put<'life0, 'life1, 'async_trait>( &'life0 self, item: &'life1 SyncItem, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

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

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if an item exists (Redis EXISTS command - fast, no data transfer).

Provided Methods§

Source

fn put_batch<'life0, 'life1, 'async_trait>( &'life0 self, items: &'life1 [SyncItem], ) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write a batch of items atomically (pipelined for Redis). Default implementation falls back to sequential puts.

Source

fn put_batch_with_ttl<'life0, 'life1, 'async_trait>( &'life0 self, items: &'life1 [SyncItem], ttl_secs: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<BatchWriteResult, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write a batch of items with optional TTL (in seconds). For Redis: uses SETEX when ttl is Some, SET when None.

Source

fn ft_create<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a RediSearch index (FT.CREATE).

Source

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

Drop a RediSearch index (FT.DROPINDEX).

Search using RediSearch (FT.SEARCH). Returns matching keys.

Source

fn ft_search_with_params<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, index: &'life1 str, query: &'life2 str, params: &'life3 [(String, Vec<u8>)], limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Search using RediSearch with binary parameters (for vector KNN search). The params are (name, blob) pairs passed as PARAMS to FT.SEARCH.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§