Trait sessions::Storage

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

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

A Storage Trait

Required Methods§

source

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

Gets a Data from storage by the key

source

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

Sets a session Data into storage

source

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

Removes a data from storage by the key

Provided Methods§

source

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

Resets the storage and remove all keys

source

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

Closes the connection

Object Safety§

This trait is not object safe.

Implementors§