Module: SlavePools
- Defined in:
- lib/slave_pools.rb,
lib/slave_pools/pool.rb,
lib/slave_pools/pools.rb,
lib/slave_pools/config.rb,
lib/slave_pools/engine.rb,
lib/slave_pools/hijack.rb,
lib/slave_pools/version.rb,
lib/slave_pools/query_cache.rb,
lib/slave_pools/connection_proxy.rb,
lib/slave_pools/active_record_extensions.rb
Defined Under Namespace
Modules: ActiveRecordExtensions, Hijack, QueryCache
Classes: Config, ConnectionProxy, Engine, Pool, Pools
Constant Summary
collapse
- VERSION =
"1.2.0"
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
16
17
18
|
# File 'lib/slave_pools.rb', line 16
def config
@config ||= SlavePools::Config.new
end
|
.current ⇒ Object
35
36
37
|
# File 'lib/slave_pools.rb', line 35
def current
proxy.current
end
|
.log(level, message) ⇒ Object
55
56
57
|
# File 'lib/slave_pools.rb', line 55
def log(level, message)
logger.send(level, "[SlavePools] #{message}")
end
|
.logger ⇒ Object
59
60
61
|
# File 'lib/slave_pools.rb', line 59
def logger
ActiveRecord::Base.logger
end
|
.next_slave! ⇒ Object
39
40
41
|
# File 'lib/slave_pools.rb', line 39
def next_slave!
proxy.next_slave!
end
|
.pools ⇒ Object
51
52
53
|
# File 'lib/slave_pools.rb', line 51
def pools
Thread.current[:slave_pools] ||= SlavePools::Pools.new
end
|
.with_master ⇒ Object
47
48
49
|
# File 'lib/slave_pools.rb', line 47
def with_master
proxy.with_master{ yield }
end
|
.with_pool(*a) ⇒ Object
43
44
45
|
# File 'lib/slave_pools.rb', line 43
def with_pool(*a)
proxy.with_pool(*a){ yield }
end
|