Skip to content

Commit b46dba9

Browse files
committed
Internal docs for the query cache store
1 parent ca37289 commit b46dba9

File tree

1 file changed

+12
-0
lines changed
  • activerecord/lib/active_record/connection_adapters/abstract

1 file changed

+12
-0
lines changed

activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ def #{method_name}(...)
3131
end
3232
end
3333

34+
# This is the actual query cache store.
35+
#
36+
# It has an internal hash whose keys are either SQL strings, or arrays of
37+
# two elements [SQL string, binds], if there are binds. The hash values
38+
# are their corresponding ActiveRecord::Result objects.
39+
#
40+
# Keeping the hash size under max size is achieved with LRU eviction.
41+
#
42+
# The store gets passed a version object, which is shared among the query
43+
# cache stores of a given connection pool (see ConnectionPoolConfiguration
44+
# down below). The version value may be externally changed as a way to
45+
# signal cache invalidation, that is why all methods have a guard for it.
3446
class Store # :nodoc:
3547
attr_accessor :enabled, :dirties
3648
alias_method :enabled?, :enabled

0 commit comments

Comments
 (0)