class OTR::ActiveRecord::QueryCache

Rack middleware to enable ActiveRecord's query cache for each request.

Public Class Methods

new(app) click to toggle source
# File lib/otr-activerecord/middleware/query_cache.rb, line 7
def initialize(app)
  @handler = case ::ActiveRecord::VERSION::MAJOR
             when 4 then ::ActiveRecord::QueryCache.new(app)
             when 5, 6 then ActionDispatchHandler.new(app)
             end
end

Public Instance Methods

call(env) click to toggle source
# File lib/otr-activerecord/middleware/query_cache.rb, line 14
def call(env)
  @handler.call(env)
end