module ActiveRecord::ConnectionAdapters::QueryCache

def dirties_query_cache(base, *method_names)

def dirties_query_cache(base, *method_names)
  method_names.each do |method_name|
    base.class_eval <<-end_code, __FILE__, __LINE__ + 1
      def #{method_name}(...)
        if pool.dirties_query_cache
          ActiveRecord::Base.clear_query_caches_for_current_thread
        end
        super
      end
    end_code
  end
end