pub struct QueryResultCache<V: Clone> { /* private fields */ }Expand description
Query result cache with TTL and LRU eviction
Thread-safe cache implementation optimized for concurrent SPARQL query workloads. Uses read-write locks with minimal contention and efficient memory management.
Implementations§
Source§impl<V: Clone> QueryResultCache<V>
impl<V: Clone> QueryResultCache<V>
Sourcepub fn new(config: CacheConfig) -> Self
pub fn new(config: CacheConfig) -> Self
Create a new query result cache with the given configuration
Sourcepub fn put_with_ttl(&self, key: String, value: V, ttl: Duration)
pub fn put_with_ttl(&self, key: String, value: V, ttl: Duration)
Put a value in the cache with custom TTL
Sourcepub fn invalidate(&self, key: &str) -> bool
pub fn invalidate(&self, key: &str) -> bool
Invalidate (remove) a cache entry
Sourcepub fn memory_usage(&self) -> u64
pub fn memory_usage(&self) -> u64
Get current memory usage in bytes
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for QueryResultCache<V>
impl<V> RefUnwindSafe for QueryResultCache<V>
impl<V> Send for QueryResultCache<V>
impl<V> Sync for QueryResultCache<V>
impl<V> Unpin for QueryResultCache<V>
impl<V> UnsafeUnpin for QueryResultCache<V>
impl<V> UnwindSafe for QueryResultCache<V>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more