Expand description
Core-level SPARQL query result cache with LRU eviction and delta-based invalidation.
This module provides a thread-safe, dataset-scoped cache for SPARQL query results. It is designed to sit at the core layer, below the individual query engine implementations, so that all engines (ARQ, rule-based, federated, …) can share a single cache.
§Features
- FNV-1a fingerprinting: Fast, collision-resistant query hashing.
- LRU eviction: Least-recently-used entries are evicted when the capacity is reached.
- TTL expiration: Entries expire after a configurable time-to-live.
- Dataset-scoped invalidation: All entries belonging to a dataset can be invalidated in one call, e.g. after bulk updates.
- Predicate-scoped invalidation: Only entries that accessed a specific predicate are invalidated — allowing fine-grained cache management.
- Delta-driven invalidation: A list of
TripleDeltaevents is used to determine exactly which entries are affected by a set of changes. - Metrics: Hit/miss counters accessible via atomic loads.
§Thread safety
All public methods take &self; internal state is protected by a Mutex. The design avoids
RwLock because writes (TTL/access-time updates on cache hit) are almost as frequent as reads.
Re-exports§
pub use crate::view::incremental::TripleDelta;
Structs§
- Core
Cache Entry - An individual entry in the result cache.
- Core
Cache Key - A composite cache key that uniquely identifies a cached query result.
- Core
Result Cache - Thread-safe core-level SPARQL query result cache.