module
CQL::Cache::Middleware::BaseMiddleware
Overview
Base middleware functionality that can be adapted for different frameworks
Direct including types
Defined in:
cache/middleware.crInstance Method Summary
-
#enable_query_cache(enabled : Bool = true) : Nil
Enable/disable query caching
-
#end_request_cache : Nil
Call this at the end of each request (
CQL.end_request_cache). -
#query_cache_stats : Hash(String, String | Int32 | Int64 | Float64)
Get cache statistics (useful for debugging)
-
#start_request_cache(request_id : String | Nil = nil) : Nil
Call this at the start of each request.
-
#with_request_cache(request_id : String | Nil = nil, &)
Runs the block as one request (
CQL.with_request_cache, with the id validated): it starts and ends a request only when the switches are on at the start.
Instance Method Detail
Call this at the end of each request (CQL.end_request_cache). It ends the fiber's request even when the
switches are off; #with_request_cache ends only a request it started.
Get cache statistics (useful for debugging)
Call this at the start of each request. Tracks only when CQL.config.cache.on? and
CQL.config.cache.request_cache? (CQL.start_request_cache).
Runs the block as one request (CQL.with_request_cache, with the id validated): it starts and ends a
request only when the switches are on at the start.