module RecordCache
Public Class Methods
config(opts = nil)
click to toggle source
# File lib/record_cache.rb, line 13 def self.config(opts = nil) if opts config.merge!(opts) else @config ||= {} end end
db(model_class)
click to toggle source
# File lib/record_cache.rb, line 21 def self.db(model_class) db = model_class.connection # Always use the master connection since we are caching. @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