Class: ActiveSupport::Cache::MultiStore

Inherits:
Store
  • Object
show all
Defined in:
lib/active_support/cache/multi_store.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*stores) ⇒ MultiStore

Returns a new instance of MultiStore.



4
5
6
7
8
# File 'lib/active_support/cache/multi_store.rb', line 4

def initialize(*stores)
  @monitor = Monitor.new
  @stores = stores
  super(stores.extract_options!)
end

Class Method Details

.send_to_all(*methods) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/active_support/cache/multi_store.rb', line 10

def self.send_to_all(*methods)
  methods.each do |method|
    define_method method do |*args|
      synchronize do
        @stores.map { |store| store.send(method, *args) }
      end
    end
  end
end