Sha256: 2c773afd9339295bd6792bcf5707664b237d3b3f7f07d27e27cfe51d62a0f695

Contents?: true

Size: 520 Bytes

Versions: 39

Compression:

Stored size: 520 Bytes

Contents

module Switchman
  module ActiveSupport
    module Cache
      module ClassMethods
        def lookup_store_with_sharding(*store_options)
          store = lookup_store_without_sharding(*store_options)
          store.options[:namespace] ||= lambda { Shard.current.default? ? nil : "shard_#{Shard.current.id}" }
          store
        end
      end

      def self.included(klass)
        klass.extend(ClassMethods)
        klass.singleton_class.alias_method_chain(:lookup_store, :sharding)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
switchman-1.4.3 lib/switchman/active_support/cache.rb
switchman-1.4.2 lib/switchman/active_support/cache.rb
switchman-1.4.1 lib/switchman/active_support/cache.rb
switchman-1.4.0 lib/switchman/active_support/cache.rb
switchman-1.3.18 lib/switchman/active_support/cache.rb
switchman-1.3.17 lib/switchman/active_support/cache.rb
switchman-1.3.14.pre.1 lib/switchman/active_support/cache.rb
switchman-1.3.13.pre.1 lib/switchman/active_support/cache.rb
switchman-1.3.16 lib/switchman/active_support/cache.rb
switchman-1.3.15 lib/switchman/active_support/cache.rb
switchman-1.3.14 lib/switchman/active_support/cache.rb
switchman-1.3.13 lib/switchman/active_support/cache.rb
switchman-1.3.12 lib/switchman/active_support/cache.rb
switchman-1.3.11 lib/switchman/active_support/cache.rb
switchman-1.3.10 lib/switchman/active_support/cache.rb
switchman-1.3.9 lib/switchman/active_support/cache.rb
switchman-1.3.8 lib/switchman/active_support/cache.rb
switchman-1.3.7 lib/switchman/active_support/cache.rb
switchman-1.3.6 lib/switchman/active_support/cache.rb
switchman-1.3.5 lib/switchman/active_support/cache.rb