Module: SwitchPoint::Connection

Defined in:
lib/switch_point/connection.rb

Constant Summary collapse

DESTRUCTIVE_METHODS =

See ActiveRecord::ConnectionAdapters::QueryCache

[:insert, :update, :delete]

Class Method Summary collapse

Class Method Details

.proxy_to_writable(proxy, method_name, *args, &block) ⇒ Object



29
30
31
32
33
# File 'lib/switch_point/connection.rb', line 29

def self.proxy_to_writable(proxy, method_name, *args, &block)
  proxy.with_writable do
    proxy.connection.send(method_name, *args, &block)
  end
end

.purge_readonly_query_cache(proxy) ⇒ Object



35
36
37
38
39
# File 'lib/switch_point/connection.rb', line 35

def self.purge_readonly_query_cache(proxy)
  proxy.with_readonly do
    proxy.connection.clear_query_cache
  end
end