instance method lookup_sql_cache

Ruby on Rails 7.1.6

Since v7.0.10 Private

Available in: v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

lookup_sql_cache(sql, name, binds)

No documentation comment.

Parameters

sql req
name req
binds req
Source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 120
        def lookup_sql_cache(sql, name, binds)
          key = binds.empty? ? sql : [sql, binds]
          hit = false
          result = nil

          @lock.synchronize do
            if (result = @query_cache.delete(key))
              hit = true
              @query_cache[key] = result
            end
          end

          if hit
            ActiveSupport::Notifications.instrument(
              "sql.active_record",
              cache_notification_info(sql, name, binds)
            )

            result
          end
        end

Defined in activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb line 120 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::QueryCache

Type at least 2 characters to search.

↑↓ navigate · open · esc close