class Slaver::Proxy

Attributes

connection_pool[R]
klass[R]

Public Instance Methods

clear_active_connections!() click to toggle source
# File lib/slaver/proxy.rb, line 22
def clear_active_connections!
  connection_pool.release_connection
end
clear_all_connections!() click to toggle source
# File lib/slaver/proxy.rb, line 18
def clear_all_connections!
  connection_pool.disconnect!
end
connected?() click to toggle source
# File lib/slaver/proxy.rb, line 14
def connected?
  connection_pool.connected?
end
for_config(klass, config_name) click to toggle source
# File lib/slaver/proxy.rb, line 7
def for_config(klass, config_name)
  @klass = klass
  @connection_pool = klass.pools[config_name]

  self
end
method_missing(method, *args, &block) click to toggle source
# File lib/slaver/proxy.rb, line 34
def method_missing(method, *args, &block)
  safe_connection.send(method, *args, &block)
end
respond_to_missing?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/slaver/proxy.rb, line 38
def respond_to_missing?(method, include_private = false)
  safe_connection.respond_to?(method, include_private) || super
end
safe_connection() click to toggle source
# File lib/slaver/proxy.rb, line 26
def safe_connection
  connection_pool.automatic_reconnect = true
  if !connection_pool.connected? && klass.connection_without_proxy.query_cache_enabled
    connection_pool.connection.enable_query_cache!
  end
  connection_pool.connection
end