Selecto.Performance.QueryCache
(Selecto v0.4.5)
Copy Markdown
High-performance query result caching for Selecto.
Provides intelligent caching of query results with:
- Automatic cache key generation from SQL and parameters
- TTL-based expiration
- Size-based eviction (LRU)
- Cache invalidation strategies
- Cache statistics and monitoring
- ETS-backed low-latency reads
Summary
Functions
Execute a query with caching.
Returns a specification to start this module under a supervisor.
Clear entire cache.
Generate a cache key from Selecto query.
Generate a cache key from SQL and parameters.
Get a cached query result.
Invalidate cache entries by key or pattern.
Invalidate cache entries by tags.
Store a query result in cache.
Start the query cache process.
Get cache statistics.
Warm up cache with frequently used queries.
Functions
Execute a query with caching.
This is a convenience function that checks cache, executes if needed, and caches the result.
Returns a specification to start this module under a supervisor.
See Supervisor.
Clear entire cache.
Generate a cache key from Selecto query.
Generate a cache key from SQL and parameters.
Get a cached query result.
Returns {:ok, result} if found, :miss if not in cache.
Invalidate cache entries by key or pattern.
Invalidate cache entries by tags.
Store a query result in cache.
Options
:ttl- Override default TTL for this entry:tags- Tags for cache invalidation:compress- Force compression for this entry
Start the query cache process.
Options
:max_size- Maximum number of cached queries (default: 1000):default_ttl- Default TTL in milliseconds (default: 5 minutes):eviction_policy- :lru, :lfu, or :ttl (default: :lru):cache_backend- :ets (default: :ets):track_stats- Enable cache statistics (default: true):compression- Enable result compression (default: false)
Get cache statistics.
Warm up cache with frequently used queries.