Memory

Trait Memory 

Source
pub trait Memory: Send + Sync {
Show 13 methods // Required methods fn backend_name(&self) -> &str; fn set<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: MemoryValue, ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<Option<MemoryValue>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn keys<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 MemoryQuery, ) -> Pin<Box<dyn Future<Output = RragResult<Vec<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn mget<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = RragResult<Vec<Option<MemoryValue>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn mset<'life0, 'life1, 'async_trait>( &'life0 self, pairs: &'life1 [(String, MemoryValue)], ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn mdelete<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = RragResult<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn clear<'life0, 'life1, 'async_trait>( &'life0 self, namespace: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn count<'life0, 'life1, 'async_trait>( &'life0 self, namespace: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = RragResult<usize>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RragResult<MemoryStats>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Core Memory trait - abstract interface for all storage backends

Required Methods§

Source

fn backend_name(&self) -> &str

Get the name of this memory backend

Source

fn set<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: MemoryValue, ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set a value in memory

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<Option<MemoryValue>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a value from memory

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a value from memory

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a key exists

Source

fn keys<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 MemoryQuery, ) -> Pin<Box<dyn Future<Output = RragResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all keys matching a query

Source

fn mget<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = RragResult<Vec<Option<MemoryValue>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get multiple values at once

Source

fn mset<'life0, 'life1, 'async_trait>( &'life0 self, pairs: &'life1 [(String, MemoryValue)], ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set multiple values at once

Source

fn mdelete<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [String], ) -> Pin<Box<dyn Future<Output = RragResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete multiple keys at once

Source

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, namespace: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = RragResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Clear all data (with optional namespace)

Source

fn count<'life0, 'life1, 'async_trait>( &'life0 self, namespace: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = RragResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get count of keys

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RragResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if memory backend is healthy

Source

fn stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RragResult<MemoryStats>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get memory statistics

Implementors§