pub struct MemoryBackend<K, V, M = ()>{ /* private fields */ }Expand description
In-memory storage backend
Implementations§
Trait Implementations§
Source§impl<K, V, M> Clone for MemoryBackend<K, V, M>
impl<K, V, M> Clone for MemoryBackend<K, V, M>
Source§impl<K, V, M> Default for MemoryBackend<K, V, M>
impl<K, V, M> Default for MemoryBackend<K, V, M>
Source§impl<K, V, M> StorageBackend for MemoryBackend<K, V, M>where
K: Serialize + DeserializeOwned + Hash + Eq + Clone + Send + Sync + 'static,
V: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
M: Serialize + DeserializeOwned + Clone + Send + Sync + EntryMetadata,
impl<K, V, M> StorageBackend for MemoryBackend<K, V, M>where
K: Serialize + DeserializeOwned + Hash + Eq + Clone + Send + Sync + 'static,
V: Serialize + DeserializeOwned + Clone + Send + Sync + 'static,
M: Serialize + DeserializeOwned + Clone + Send + Sync + EntryMetadata,
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 HashMap<K, Vec<CacheEntry<K, V, M>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 HashMap<K, Vec<CacheEntry<K, V, M>>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save entries to storage
Source§fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Vec<CacheEntry<K, V, M>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<K, Vec<CacheEntry<K, V, M>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load entries from storage
Source§fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Remove entries for a specific key
Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all entries from storage
Source§fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contains<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 K,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if storage contains a key
Auto Trait Implementations§
impl<K, V, M> Freeze for MemoryBackend<K, V, M>
impl<K, V, M = ()> !RefUnwindSafe for MemoryBackend<K, V, M>
impl<K, V, M> Send for MemoryBackend<K, V, M>
impl<K, V, M> Sync for MemoryBackend<K, V, M>
impl<K, V, M> Unpin for MemoryBackend<K, V, M>
impl<K, V, M> UnsafeUnpin for MemoryBackend<K, V, M>
impl<K, V, M = ()> !UnwindSafe for MemoryBackend<K, V, M>
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