module CQL::Cache::Middleware::BaseMiddleware

Overview

Base middleware functionality that can be adapted for different frameworks

Direct including types

Defined in:

cache/middleware.cr

Instance Method Summary

Instance Method Detail

def enable_query_cache(enabled : Bool = true) : Nil #

Enable/disable query caching


[View source]
def end_request_cache : Nil #

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.


[View source]
def query_cache_stats : Hash(String, String | Int32 | Int64 | Float64) #

Get cache statistics (useful for debugging)


[View source]
def start_request_cache(request_id : String | Nil = nil) : Nil #

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).


[View source]
def 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.


[View source]