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§
sourcefn get(
&self,
key: &str
) -> impl Future<Output = Result<Option<BTreeMap<String, Value>>, Error>> + Send
fn get( &self, key: &str ) -> impl Future<Output = Result<Option<BTreeMap<String, Value>>, Error>> + Send
Gets a Data
from storage by the key
Provided Methods§
Object Safety§
This trait is not object safe.