Module: Switchman::ActiveRecord::QueryCache

Defined in:
lib/switchman/active_record/query_cache.rb

Overview

needs to be included in the same class as ::ActiveRecord::ConnectionAdapters::QueryCache after that module is included

Instance Method Summary collapse

Instance Method Details

#cache_sql(sql, *args, &block) ⇒ Object



6
7
8
9
# File 'lib/switchman/active_record/query_cache.rb', line 6

def cache_sql(sql, *args, &block)
  # have to include the shard id in the cache key because of switching dbs on the same connection
  super("#{self.shard.id}::#{sql}", *args, &block)
end