instance method
cache
Ruby on Rails 7.0.10
Since v2.2.3Signature
cache()
Enable the query cache within the block.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 59
def cache
old, @query_cache_enabled = @query_cache_enabled, true
yield
ensure
@query_cache_enabled = old
clear_query_cache unless @query_cache_enabled
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb line 59
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::QueryCache