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
13
14
15
16
17
18
19
|
# File 'lib/record_cache.rb', line 13
def self.config(opts = nil)
if opts
config.merge!(opts)
else
@config ||= {}
end
end
|
.db(model_class) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/record_cache.rb', line 21
def self.db(model_class)
db = model_class.connection
@has_data_fabric ||= defined?(DataFabric::ConnectionProxy)
if @has_data_fabric and db.kind_of?(DataFabric::ConnectionProxy)
model_class.record_cache_config[:use_slave] ? db.send(:connection) : db.send(:master)
else
db
end
end
|