Module cache

Module cache 

Source
Expand description

Query caching and prepared statement management.

This module provides utilities for caching SQL queries and managing prepared statements to improve performance.

§Query Cache

The QueryCache stores recently executed queries by their hash, allowing fast lookup of previously built SQL strings.

use prax_query::cache::QueryCache;

let cache = QueryCache::new(1000);

// Cache a query
cache.insert("users_by_id", "SELECT * FROM users WHERE id = $1");

// Retrieve later
if let Some(sql) = cache.get("users_by_id") {
    println!("Cached SQL: {}", sql);
}

Modules§

patterns
Common query patterns for caching.

Structs§

CacheStats
Statistics about cache usage.
CachedQuery
A cached SQL query.
ExecutionPlan
A cached execution plan with optimization hints.
ExecutionPlanCache
Cache for query execution plans.
QueryCache
A thread-safe cache for SQL queries.
QueryHash
A query hash for fast lookup.
QueryKey
A key for looking up cached queries.
SqlTemplate
A pre-parsed SQL template for fast instantiation.
SqlTemplateCache
A high-performance SQL template cache optimized for repeated queries.

Enums§

PlanHint
Hints for query execution optimization.

Functions§

get_global_template
Get a template from the global cache.
global_template_cache
Get the global SQL template cache.
precompute_query_hash
Pre-compute a query hash for repeated lookups.
register_global_template
Register a template in the global cache.