Module: ArCache::ActiveRecord::Core::ClassMethods

Defined in:
lib/ar_cache/active_record/core.rb

Instance Method Summary collapse

Instance Method Details

#findObject

The #find and #find_by use ActiveRecord::StatementCache to execute querying first. For ArCache, we need force skip ActiveRecord::StatementCache.



10
11
12
# File 'lib/ar_cache/active_record/core.rb', line 10

def find(...)
  ArCache.skip_cache? || ar_cache_table.disabled? ? super : all.find(...)
end

#find_byObject



14
15
16
# File 'lib/ar_cache/active_record/core.rb', line 14

def find_by(...)
  ArCache.skip_cache? || ar_cache_table.disabled? ? super : all.find_by(...)
end