Module: Mongoid::QueryCache::Base Deprecated

Defined in:
build/mongoid-7.3/lib/mongoid/query_cache.rb

Overview

Deprecated.

This module is only used with driver versions 2.13 and lower.

Included to add behavior for clearing out the query cache on certain operations.

Since:

  • 4.0.0

Instance Method Summary collapse

Instance Method Details

#alias_query_cache_clear(*method_names) ⇒ Object

Since:

  • 4.0.0



229
230
231
232
233
234
235
236
237
238
239
# File 'build/mongoid-7.3/lib/mongoid/query_cache.rb', line 229

def alias_query_cache_clear(*method_names)
  method_names.each do |method_name|
    define_method("#{method_name}_with_clear_cache") do |*args|
      QueryCache.clear_cache
      send("#{method_name}_without_clear_cache", *args)
    end

    alias_method "#{method_name}_without_clear_cache", method_name
    alias_method method_name, "#{method_name}_with_clear_cache"
  end
end