Struct amnesia::drivers::memory::MemoryDriver
source · pub struct MemoryDriver { /* private fields */ }Expand description
A driver that stores values in memory.
Trait Implementations§
source§impl Driver for MemoryDriver
impl Driver for MemoryDriver
type Config = ()
type Error = Error
async fn new(__arg0: Self::Config) -> Result<Self, Self::Error>
source§async fn get<T: DeserializeOwned>(
&self,
key: &str
) -> Result<Option<T>, Self::Error>
async fn get<T: DeserializeOwned>( &self, key: &str ) -> Result<Option<T>, Self::Error>
Get a value from the cache.
source§async fn has(&self, key: &str) -> Result<bool, Self::Error>
async fn has(&self, key: &str) -> Result<bool, Self::Error>
Check if a value exists in the cache.
source§async fn put<T: Serialize + Sync>(
&mut self,
key: &str,
value: &T,
duration: Option<Duration>
) -> Result<(), Self::Error>
async fn put<T: Serialize + Sync>( &mut self, key: &str, value: &T, duration: Option<Duration> ) -> Result<(), Self::Error>
Put a value into the cache.
Auto Trait Implementations§
impl RefUnwindSafe for MemoryDriver
impl Send for MemoryDriver
impl Sync for MemoryDriver
impl Unpin for MemoryDriver
impl UnwindSafe for MemoryDriver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Creates a shared type from an unshared type.