pub trait Storage: Send + Sync {
    // Required methods
    fn get(
        &self,
        key: &str
    ) -> impl Future<Output = Result<Option<Data>>> + Send;
    fn set(
        &self,
        key: &str,
        val: Data,
        exp: &Duration
    ) -> impl Future<Output = Result<()>> + Send;
    fn remove(&self, key: &str) -> impl Future<Output = Result<()>> + Send;

    // Provided methods
    fn reset(&self) -> impl Future<Output = Result<()>> + Send { ... }
    fn close(&self) -> impl Future<Output = Result<()>> + Send { ... }
}
Expand description

A Storage Trait

Required Methods§

source

fn get(&self, key: &str) -> impl Future<Output = Result<Option<Data>>> + Send

Gets a Data from storage by the key

source

fn set( &self, key: &str, val: Data, exp: &Duration ) -> impl Future<Output = Result<()>> + Send

Sets a session Data into storage

source

fn remove(&self, key: &str) -> impl Future<Output = Result<()>> + Send

Removes a data from storage by the key

Provided Methods§

source

fn reset(&self) -> impl Future<Output = Result<()>> + Send

Resets the storage and remove all keys

source

fn close(&self) -> impl Future<Output = Result<()>> + Send

Closes the connection

Object Safety§

This trait is not object safe.

Implementors§