Module: RecordCache
- Defined in:
- lib/record_cache.rb,
lib/record_cache/set.rb,
lib/record_cache/index.rb,
lib/record_cache/scope.rb
Defined Under Namespace
Modules: ActiveRecordExtension, ClassMethods, InstanceMethods
Classes: Index, Scope, Set
Class Method Summary
collapse
Class Method Details
.config(opts = nil) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/record_cache.rb', line 14
def self.config(opts = nil)
if opts
config.merge!(opts)
else
@config ||= {}
end
end
|
.db(model_class) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/record_cache.rb', line 22
def self.db(model_class)
db = model_class.connection
if defined?(DataFabric::ConnectionProxy) and db.kind_of?(DataFabric::ConnectionProxy)
model_class.record_cache_config[:use_slave] ? db.send(:connection) : db.send(:master)
else
db
end
end
|