instance method
cache_sql
Ruby on Rails 5.0.7.2
Private — implementation detail, not part of the public APISignature
cache_sql(sql, binds)
No documentation comment.
Parameters
-
sqlreq -
bindsreq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 101
def cache_sql(sql, binds)
result =
if @query_cache[sql].key?(binds)
ActiveSupport::Notifications.instrument(
"sql.active_record",
sql: sql,
binds: binds,
type_casted_binds: -> { type_casted_binds(binds) },
name: "CACHE",
connection_id: object_id,
)
@query_cache[sql][binds]
else
@query_cache[sql][binds] = yield
end
result.dup
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb line 101
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::QueryCache