pub struct InMemoryBackend { /* private fields */ }Expand description
In-memory storage backend with TTL support
Implementations§
Source§impl InMemoryBackend
impl InMemoryBackend
Sourcepub fn new() -> InMemoryBackend
pub fn new() -> InMemoryBackend
Create a new in-memory backend
Sourcepub fn with_max_entries(self, max: usize) -> InMemoryBackend
pub fn with_max_entries(self, max: usize) -> InMemoryBackend
Create with maximum entry limit
Sourcepub fn with_ttl_seconds(self, seconds: i64) -> InMemoryBackend
pub fn with_ttl_seconds(self, seconds: i64) -> InMemoryBackend
Create with default TTL
Trait Implementations§
Source§impl Default for InMemoryBackend
impl Default for InMemoryBackend
Source§fn default() -> InMemoryBackend
fn default() -> InMemoryBackend
Returns the “default value” for a type. Read more
Source§impl Memory for InMemoryBackend
impl Memory for InMemoryBackend
Source§fn store<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryBackend: 'async_trait,
fn store<'life0, 'async_trait>(
&'life0 self,
entry: MemoryEntry,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryBackend: 'async_trait,
Store an entry
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryBackend: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<MemoryEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryBackend: 'async_trait,
Retrieve by ID
Source§fn search<'life0, 'async_trait>(
&'life0 self,
query: MemoryQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryBackend: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
query: MemoryQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryEntry>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryBackend: 'async_trait,
Search with filters
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryBackend: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryBackend: 'async_trait,
Delete an entry
Source§impl MemoryFromConfig for InMemoryBackend
impl MemoryFromConfig for InMemoryBackend
Source§fn from_config(config: &MemoryConfig) -> Self
fn from_config(config: &MemoryConfig) -> Self
Create a memory backend from a
MemoryConfig.Auto Trait Implementations§
impl Freeze for InMemoryBackend
impl !RefUnwindSafe for InMemoryBackend
impl Send for InMemoryBackend
impl Sync for InMemoryBackend
impl Unpin for InMemoryBackend
impl !UnwindSafe for InMemoryBackend
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more