Sha256: 2021edc73d0e9190dcb6c13c70e2a31b7cfb20ba1cb26ecd1e77ed8494cce31a
Contents?: true
Size: 797 Bytes
Versions: 40
Compression:
Stored size: 797 Bytes
Contents
require 'active_support/core_ext/object/blank' module ActiveRecord # = Active Record Query Cache class QueryCache module ClassMethods # Enable the query cache within the block if Active Record is configured. def cache(&block) if ActiveRecord::Base.configurations.blank? yield else connection.cache(&block) end end # Disable the query cache within the block if Active Record is configured. def uncached(&block) if ActiveRecord::Base.configurations.blank? yield else connection.uncached(&block) end end end def initialize(app) @app = app end def call(env) ActiveRecord::Base.cache do @app.call(env) end end end end
Version data entries
40 entries across 40 versions & 2 rubygems