pub struct PaginationCache<T, M = ()> { /* private fields */ }Expand description
Two-level locking pagination cache generic over result T and optional meta M.
The meta type M allows storing additional per-query context alongside results, such as warnings or metadata from the original query.
Implementations§
Source§impl<T, M> PaginationCache<T, M>
impl<T, M> PaginationCache<T, M>
Sourcepub fn remove_if_same(&self, key: &str, candidate: &Arc<QueryLock<T, M>>)
pub fn remove_if_same(&self, key: &str, candidate: &Arc<QueryLock<T, M>>)
Remove entry if it still points to the provided Arc.
This is safe for concurrent access - only removes if the current entry is the exact same Arc, preventing removal of a replaced entry.
Source§impl<T, M: Default> PaginationCache<T, M>
impl<T, M: Default> PaginationCache<T, M>
Sourcepub fn get_or_create(&self, key: &str) -> Arc<QueryLock<T, M>>
pub fn get_or_create(&self, key: &str) -> Arc<QueryLock<T, M>>
Get or create the per-query lock for the given key.
If a lock already exists for this key, returns a clone of its Arc. Otherwise creates a new QueryLock and returns it.
Sourcepub fn sweep_expired(&self)
pub fn sweep_expired(&self)
Opportunistic sweep: remove expired entries.
Call this periodically to clean up stale cache entries. Each expired entry is only removed if it hasn’t been replaced.
Trait Implementations§
Auto Trait Implementations§
impl<T, M = ()> !Freeze for PaginationCache<T, M>
impl<T, M> RefUnwindSafe for PaginationCache<T, M>
impl<T, M> Send for PaginationCache<T, M>
impl<T, M> Sync for PaginationCache<T, M>
impl<T, M> Unpin for PaginationCache<T, M>
impl<T, M> UnwindSafe for PaginationCache<T, M>
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