pub trait CacheDb<S>:
Clone
+ Send
+ Syncwhere
S: Dto,{
// Required methods
fn get_from_db(
&self,
prefix: Option<&str>,
key: &ModelKey,
) -> Result<Option<String>, DbError>;
fn set_in_db(
&self,
prefix: Option<&str>,
key: &ModelKey,
state: String,
) -> Result<(), DbError>;
// Provided methods
fn get(
&self,
prefix: Option<&str>,
key: &ModelKey,
) -> Result<ModelWithPosition<S>, DbError> { ... }
fn set(
&self,
key: &ModelKey,
data: ModelWithPosition<S>,
prefix: Option<&str>,
) -> Result<(), DbError> { ... }
}Expand description
CacheDb has only one purpose, reading and writing state somewhere
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".