pub trait MemoryBackend: Send + Sync {
// Required methods
fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
namespace: Option<&'life3 str>,
ttl_seconds: Option<u64>,
tags: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
namespace: Option<&'life2 str>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, f64)>, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
A pluggable memory storage backend.
Supports key-value storage with optional namespace isolation, TTL, tags, and semantic search. Implementations may use in-memory stores, SQLite, HNSW indices, or external services.
Required Methods§
Sourcefn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
namespace: Option<&'life3 str>,
ttl_seconds: Option<u64>,
tags: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 str,
namespace: Option<&'life3 str>,
ttl_seconds: Option<u64>,
tags: Option<Vec<String>>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a value with optional metadata.
Sourcefn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn retrieve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve a value by key.
Sourcefn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
namespace: Option<&'life2 str>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, f64)>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
namespace: Option<&'life2 str>,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, f64)>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search for values matching a query string.
Returns a list of (key, value, relevance_score) tuples.
Sourcefn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
namespace: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<bool, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete a value by key. Returns true if the key existed.