Sha256: f0c1ea8df60f8d61df539e5a3f31a345f11f615436e7edca8a41855593971ed1
Contents?: true
Size: 717 Bytes
Versions: 66
Compression:
Stored size: 717 Bytes
Contents
module ActiveRecord 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
66 entries across 65 versions & 12 rubygems