cache_sql(sql, name, binds) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 103
        def cache_sql(sql, name, binds)
          @lock.synchronize do
            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: name,
                  connection_id: object_id,
                  cached: true,
                )
                @query_cache[sql][binds]
              else
                @query_cache[sql][binds] = yield
              end
            result.dup
          end
        end
Register or log in to add new notes.