pub struct MemorySessionVersionCache { /* private fields */ }Expand description
In-memory SessionVersionCache. Default choice for SDK consumers.
tokio::sync::RwLock<HashMap<String, (sv, Instant)>> with lazy
eviction on read (entries past their TTL are treated as miss) plus a
10 000-entry cap with opportunistic pruning on set (see source for
the exact policy). Production consumers with many pods may want to
plug in a shared cache (Redis, KVRocks) so a break-glass on one pod
converges on all pods within the same 60 s window; the in-memory
default is per-pod.
Implementations§
Trait Implementations§
Source§impl Default for MemorySessionVersionCache
impl Default for MemorySessionVersionCache
Source§impl SessionVersionCache for MemorySessionVersionCache
impl SessionVersionCache for MemorySessionVersionCache
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<i64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
sv: i64,
_ttl: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for MemorySessionVersionCache
impl !RefUnwindSafe for MemorySessionVersionCache
impl Send for MemorySessionVersionCache
impl Sync for MemorySessionVersionCache
impl Unpin for MemorySessionVersionCache
impl UnsafeUnpin for MemorySessionVersionCache
impl !UnwindSafe for MemorySessionVersionCache
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