Sha256: adbd9497ac3285fa1104aaed1d86a534bb6077fd07a83b96c281bee07f406a4b

Contents?: true

Size: 590 Bytes

Versions: 97

Compression:

Stored size: 590 Bytes

Contents

module Switchman::Rails
  module ClassMethods
    def self.prepended(klass)
      # in Rails 4+, the Rails.cache= method was used during bootstrap to set
      # Rails.cache(_without_sharding) to the value from the config file. but now
      # that that's done (the bootstrap happened before this module is included
      # into Rails), we want to make sure no one tries to assign to Rails.cache,
      # because it would be wrong w.r.t. sharding.
      klass.send(:remove_method, :cache=)
    end

    def cache
      Switchman::Shard.current.database_server.cache_store
    end
  end
end

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
switchman-2.0.1 lib/switchman/rails.rb
switchman-2.0.0 lib/switchman/rails.rb
switchman-1.16.0 lib/switchman/rails.rb
switchman-1.15.2 lib/switchman/rails.rb
switchman-1.15.1 lib/switchman/rails.rb
switchman-1.15.0 lib/switchman/rails.rb
switchman-1.14.10 lib/switchman/rails.rb
switchman-1.14.9 lib/switchman/rails.rb
switchman-1.14.8 lib/switchman/rails.rb
switchman-1.14.7 lib/switchman/rails.rb
switchman-1.14.6 lib/switchman/rails.rb
switchman-1.14.5 lib/switchman/rails.rb
switchman-1.14.4 lib/switchman/rails.rb
switchman-1.14.3 lib/switchman/rails.rb
switchman-1.14.2 lib/switchman/rails.rb
switchman-1.14.1 lib/switchman/rails.rb
switchman-1.14.0 lib/switchman/rails.rb
switchman-1.13.3 lib/switchman/rails.rb
switchman-1.13.2 lib/switchman/rails.rb
switchman-1.13.1 lib/switchman/rails.rb