module ArCache::ActiveRecord::Relation

Public Instance Methods

delete_all() click to toggle source
Calls superclass method
# File lib/ar_cache/active_record/relation.rb, line 18
def delete_all
  ArCache.skip_expire { delete_ar_cache_primary_keys ? super : 0 }
end
explain() click to toggle source
Calls superclass method
# File lib/ar_cache/active_record/relation.rb, line 10
def explain
  ArCache.skip_cache { super }
end
reload() click to toggle source
Calls superclass method
# File lib/ar_cache/active_record/relation.rb, line 6
def reload
  loaded? ? ArCache.skip_cache { super } : super
end
update_all(...) click to toggle source
Calls superclass method
# File lib/ar_cache/active_record/relation.rb, line 14
def update_all(...)
  ArCache.skip_expire { delete_ar_cache_primary_keys ? super : 0 }
end

Private Instance Methods

delete_ar_cache_primary_keys() click to toggle source
# File lib/ar_cache/active_record/relation.rb, line 22
        def delete_ar_cache_primary_keys
  return true if klass.ar_cache_table.disabled?

  where_clause = ArCache::WhereClause.new(klass, arel.constraints)
  keys = if where_clause.cacheable? && where_clause.primary_key_index?
           where_clause.primary_cache_keys
         else
           pluck(primary_key).map { |item| klass.ar_cache_table.primary_cache_key(item) }
         end

  return false if keys.empty?

  @klass.connection.current_transaction.delete_ar_cache_primary_keys(keys, @klass.ar_cache_table)
  true
end
exec_queries(&block) click to toggle source
Calls superclass method
# File lib/ar_cache/active_record/relation.rb, line 38
        def exec_queries(&block)
  ArCache.skip_cache? ? super : ArCache::Query.new(self).exec_queries(&block).freeze
end