Skip to main content

Module cache

Module cache 

Source
Expand description

Query cache for parsed and planned queries.

This module provides an LRU cache for query plans to avoid repeated parsing and optimization of frequently executed queries.

§Cache Levels

  • Parsed cache: Caches logical plans after translation (language-specific parsing)
  • Optimized cache: Caches logical plans after optimization

§Usage

let cache = QueryCache::new(1000);

// Check cache first
if let Some(plan) = cache.get_optimized(&cache_key) {
    return execute(plan);
}

// Parse and optimize
let plan = parse_and_optimize(query)?;
cache.put_optimized(cache_key, plan.clone());
execute(plan)

Structs§

CacheKey
Cache key combining query text and language.
CacheStats
Cache statistics.
CachingQueryProcessor
A caching wrapper for the query processor.
QueryCache
Query cache for parsed and optimized plans.