pub struct MemoryState { /* private fields */ }Expand description
In-memory State. Cheap to share behind an Arc.
Implementations§
Source§impl MemoryState
impl MemoryState
Sourcepub fn from_snapshot(entries: Map<String, Value>) -> Self
pub fn from_snapshot(entries: Map<String, Value>) -> Self
Rebuild from a persisted snapshot. TTLs are not persisted: a durable instance’s expiry is owned by its lifecycle, not by per-key timers.
Trait Implementations§
Source§impl Default for MemoryState
impl Default for MemoryState
Source§fn default() -> MemoryState
fn default() -> MemoryState
Returns the “default value” for a type. Read more
Source§impl State for MemoryState
impl State for MemoryState
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
item: Value,
max_len: Option<usize>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
item: Value,
max_len: Option<usize>,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append
item to the list at key, keeping at most max_len entries
(oldest dropped first). Creates the list if absent. ttl bounds the
key’s lifetime.Auto Trait Implementations§
impl !Freeze for MemoryState
impl RefUnwindSafe for MemoryState
impl Send for MemoryState
impl Sync for MemoryState
impl Unpin for MemoryState
impl UnsafeUnpin for MemoryState
impl UnwindSafe for MemoryState
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