Expand description
oxisql-cache — SQL query-result and prepared-plan caching for OxiSQL.
SqlQueryCache caches query result sets and SqlPlanCache caches
prepared statement plans, both built on top of the LRU + TTL primitives in
oxistore_cache.
This crate supersedes the former sql feature of oxistore-cache: the
SQL-layer cache types now live here, on the oxisql side of the
dependency graph, so that oxistore-cache no longer needs to depend on
oxisql-core (which broke a cross-repo dependency cycle between the
oxisql and oxistore repositories). The sanctioned dependency direction
is oxisql-cache → oxistore-cache.
§SqlQueryCache
Caches RowSet results produced by SQL queries. Keys are normalised
query strings (leading/trailing whitespace collapsed, consecutive spaces
reduced to a single space, and ASCII letters upper-cased). Values are
cloned RowSet instances.
TTL support allows stale result sets to be expired automatically; the next
get after expiry returns None and the stale entry is removed lazily.
§SqlPlanCache
Stores an opaque, caller-supplied prepared-statement representation P
(e.g. a compiled query plan or a byte buffer). Unlike SqlQueryCache
there is no default TTL — plans are typically valid for the lifetime of the
connection and are only evicted by capacity pressure or explicit removal.
Both caches are not thread-safe on their own; wrap with
oxistore_cache::sync::SyncCache or oxistore_cache::sharded::ShardedCache
for concurrent use.
Structs§
- Cached
Query Runner - A read-through adapter that wraps a synchronous query executor with a
SqlQueryCache. - Query
Cache Stats - Statistics snapshot for
SqlQueryCache. - SqlPlan
Cache - In-memory LRU cache of prepared SQL statement plans.
- SqlQuery
Cache - In-memory LRU cache of SQL query result sets.