Module: Switchman::Rails::ClassMethods

Defined in:
lib/switchman/rails.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(klass) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/switchman/rails.rb', line 3

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

Instance Method Details

#cacheObject



12
13
14
# File 'lib/switchman/rails.rb', line 12

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