pub struct InMemorySessionKv { /* private fields */ }Expand description
Bounded in-memory store.
The optional shared_bytes counter is where a server-wide KV budget across
live sessions attaches: the per-session and aggregate reservations are taken
together and both unwound if either fails.
Implementations§
Trait Implementations§
Source§impl Default for InMemorySessionKv
impl Default for InMemorySessionKv
Source§impl Drop for InMemorySessionKv
Releasing on drop is what makes the aggregate budget usable for session
lifetime: a session ends by having its store dropped, not by removing every
key first, so without this the reservation of every ended session would be
held forever and the budget would ratchet to its cap.
impl Drop for InMemorySessionKv
Releasing on drop is what makes the aggregate budget usable for session lifetime: a session ends by having its store dropped, not by removing every key first, so without this the reservation of every ended session would be held forever and the budget would ratchet to its cap.
Source§impl SessionKvStore for InMemorySessionKv
impl SessionKvStore for InMemorySessionKv
Source§fn get(&self, key: &[u16]) -> Result<Option<Vec<u16>>, SessionKvError>
fn get(&self, key: &[u16]) -> Result<Option<Vec<u16>>, SessionKvError>
Ok(None) is an absent key. A present entry holding a serialized
null returns Ok(Some(..)) — callers distinguish the two.fn has(&self, key: &[u16]) -> Result<bool, SessionKvError>
fn set(&self, key: &[u16], payload: &[u16]) -> Result<(), SessionKvError>
Source§fn remove(&self, key: &[u16]) -> Result<bool, SessionKvError>
fn remove(&self, key: &[u16]) -> Result<bool, SessionKvError>
Ok(true) when an entry existed and was removed.Source§fn scan(
&self,
after: Option<&[u16]>,
prefix: &[u16],
max_scan: usize,
) -> Result<SessionKvPage, SessionKvError>
fn scan( &self, after: Option<&[u16]>, prefix: &[u16], max_scan: usize, ) -> Result<SessionKvPage, SessionKvError>
Keys in UTF-16 code-unit order, strictly after
after when given and
starting with prefix. Scans at most max_scan keys; matching is exact
code units, with no normalization or path semantics.fn limits(&self) -> SessionKvLimits
Auto Trait Implementations§
impl !Freeze for InMemorySessionKv
impl RefUnwindSafe for InMemorySessionKv
impl Send for InMemorySessionKv
impl Sync for InMemorySessionKv
impl Unpin for InMemorySessionKv
impl UnsafeUnpin for InMemorySessionKv
impl UnwindSafe for InMemorySessionKv
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