instance method
cache_sql
Ruby on Rails 6.1.7.10
Since v2.2.3 PrivateSignature
cache_sql(sql, name, binds)
No documentation comment.
Parameters
-
sqlreq -
namereq -
bindsreq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 108
def cache_sql(sql, name, binds)
@lock.synchronize do
result =
if @query_cache[sql].key?(binds)
ActiveSupport::Notifications.instrument(
"sql.active_record",
cache_notification_info(sql, name, binds)
)
@query_cache[sql][binds]
else
@query_cache[sql][binds] = yield
end
result.dup
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb line 108
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::QueryCache