pub struct MemoryResultCache { /* private fields */ }Expand description
Process-local, in-memory ResultCache.
Backed by a HashMap<String, Vec<Value>> under a std::sync::Mutex.
Operations are short-lived and fully synchronous, so the mutex is
never held across an .await point.
Implementations§
Source§impl MemoryResultCache
impl MemoryResultCache
Sourcepub fn live_handles(&self) -> usize
pub fn live_handles(&self) -> usize
Number of live handles. Useful for assertions and release audits.
Trait Implementations§
Source§impl Debug for MemoryResultCache
impl Debug for MemoryResultCache
Source§impl Default for MemoryResultCache
impl Default for MemoryResultCache
Source§fn default() -> MemoryResultCache
fn default() -> MemoryResultCache
Returns the “default value” for a type. Read more
Source§impl ResultCache for MemoryResultCache
impl ResultCache for MemoryResultCache
Source§fn store(&self, items: Vec<Value>) -> CachedResultHandle
fn store(&self, items: Vec<Value>) -> CachedResultHandle
Store
items and return the handle the caller should publish.Source§fn page(
&self,
handle: &CachedResultHandle,
offset: usize,
limit: usize,
) -> Option<Vec<Value>>
fn page( &self, handle: &CachedResultHandle, offset: usize, limit: usize, ) -> Option<Vec<Value>>
Return up to
limit items starting at offset. Returns None
if the handle has been released or never existed; returns
Some(empty) if the offset is past the end.Source§fn len(&self, handle: &CachedResultHandle) -> Option<usize>
fn len(&self, handle: &CachedResultHandle) -> Option<usize>
Total item count for
handle, or None if missing.Source§fn release(&self, handle: &CachedResultHandle) -> bool
fn release(&self, handle: &CachedResultHandle) -> bool
Release the handle. Returns
true if it existed.Auto Trait Implementations§
impl !Freeze for MemoryResultCache
impl RefUnwindSafe for MemoryResultCache
impl Send for MemoryResultCache
impl Sync for MemoryResultCache
impl Unpin for MemoryResultCache
impl UnsafeUnpin for MemoryResultCache
impl UnwindSafe for MemoryResultCache
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