X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factiverecord%2Flib%2Factive_record%2Fquery_cache.rb;fp=vendor%2Frails%2Factiverecord%2Flib%2Factive_record%2Fquery_cache.rb;h=a8af89fcb94dfd8ef2a01bb5030f2bffe76852cf;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git diff --git a/vendor/rails/activerecord/lib/active_record/query_cache.rb b/vendor/rails/activerecord/lib/active_record/query_cache.rb new file mode 100644 index 0000000..a8af89f --- /dev/null +++ b/vendor/rails/activerecord/lib/active_record/query_cache.rb @@ -0,0 +1,21 @@ +module ActiveRecord + module QueryCache + # 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 +end