pub trait BackingStore {
type Key: Eq + Hash + Clone;
type Value: Clone;
type Error: Debug;
// Required methods
fn write(
&mut self,
key: &Self::Key,
value: &Self::Value,
) -> Result<(), Self::Error>;
fn read(&self, key: &Self::Key) -> Result<Option<Self::Value>, Self::Error>;
fn delete(&mut self, key: &Self::Key) -> Result<(), Self::Error>;
}Expand description
Abstraction over the origin data store that the cache sits in front of.
Implementations are expected to be synchronous. For async I/O, the caller should provide a blocking adapter.
Required Associated Types§
Required Methods§
Sourcefn write(
&mut self,
key: &Self::Key,
value: &Self::Value,
) -> Result<(), Self::Error>
fn write( &mut self, key: &Self::Key, value: &Self::Value, ) -> Result<(), Self::Error>
Write (key, value) to the backing store.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".