aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2019-01-29 13:18:58 -0500
committerEileen Uchitelle <eileencodes@gmail.com>2019-02-01 16:05:25 -0500
commit183c0eb472a33e4f1f2cd9502f238d4b6027f887 (patch)
tree4bb649a49d8ee0dd1dc037d13b0c55bad7f5bae2 /activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
parent79bc9e81c3d47be6336223be39cb3bcaeddc0a39 (diff)
downloadrails-183c0eb472a33e4f1f2cd9502f238d4b6027f887.tar.gz
rails-183c0eb472a33e4f1f2cd9502f238d4b6027f887.tar.bz2
rails-183c0eb472a33e4f1f2cd9502f238d4b6027f887.zip
Invalidate query cache for all connections in the current thread
This change ensures that all query cahces are cleared across all connections per handler for the current thread so if you write on one connection the read will have the query cache cleared.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
index 8aeb934ec2..4e55fcae2f 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
@@ -17,7 +17,7 @@ module ActiveRecord
method_names.each do |method_name|
base.class_eval <<-end_code, __FILE__, __LINE__ + 1
def #{method_name}(*)
- clear_query_cache if @query_cache_enabled
+ ActiveRecord::Base.clear_query_caches_for_current_thread if @query_cache_enabled
super
end
end_code