Module: Switchman::ActiveSupport::Cache::ClassMethods
- Defined in:
- lib/switchman/active_support/cache.rb
Instance Method Summary collapse
Instance Method Details
#lookup_store(*store_options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/switchman/active_support/cache.rb', line 23 def lookup_store(*) store = super # can't use defined?, because it's a _ruby_ autoloaded constant, # so just checking that will cause it to get required if store.instance_of?(ActiveSupport::Cache::RedisCacheStore) && !::ActiveSupport::Cache::RedisCacheStore <= RedisCacheStore ::ActiveSupport::Cache::RedisCacheStore.prepend(RedisCacheStore) end store.[:namespace] ||= -> { Shard.current.default? ? nil : "shard_#{Shard.current.id}" } store end |
#lookup_stores(cache_store_config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/switchman/active_support/cache.rb', line 7 def lookup_stores(cache_store_config) result = {} cache_store_config.each do |key, value| next if value.is_a?(String) result[key] = ::ActiveSupport::Cache.lookup_store(value) end cache_store_config.each do |key, value| # rubocop:disable Style/CombinableLoops next unless value.is_a?(String) result[key] = result[value] end result end |