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§
- Cache
Stats - Statistics about cache usage.
- Cached
Query - A cached SQL query.
- Query
Cache - A thread-safe cache for SQL queries.
- Query
Hash - A query hash for fast lookup.
- Query
Key - A key for looking up cached queries.
- SqlTemplate
- A pre-parsed SQL template for fast instantiation.
- SqlTemplate
Cache - A high-performance SQL template cache optimized for repeated queries.
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.