pub struct MemoryStorage { /* private fields */ }
Expand description
In-memory storage using DashMap
Implementations§
Source§impl MemoryStorage
impl MemoryStorage
Sourcepub async fn new(config: StorageConfig) -> Result<MemoryStorage, MapletError>
pub async fn new(config: StorageConfig) -> Result<MemoryStorage, MapletError>
Create a new memory storage
Trait Implementations§
Source§impl Storage for MemoryStorage
impl Storage for MemoryStorage
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
Get a value by key
Source§fn set<'life0, 'async_trait>(
&'life0 self,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn set<'life0, 'async_trait>(
&'life0 self,
key: String,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Set a key-value pair
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
Delete a key
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MemoryStorage: 'async_trait,
Check if a key exists
Source§fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Get all keys
Source§fn clear_database<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn clear_database<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Clear all data
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Flush any pending writes
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Close the storage backend
Source§fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats, MapletError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MemoryStorage: 'async_trait,
Get storage statistics
Auto Trait Implementations§
impl Freeze for MemoryStorage
impl !RefUnwindSafe for MemoryStorage
impl Send for MemoryStorage
impl Sync for MemoryStorage
impl Unpin for MemoryStorage
impl !UnwindSafe for MemoryStorage
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