Class: ActiveSupport::Cache::Level2

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store_options) ⇒ Level2

Returns a new instance of Level2.



8
9
10
11
12
13
14
# File 'lib/active_support/cache/level2.rb', line 8

def initialize(store_options)
  @lock = Mutex.new
  @stores = store_options.each_with_object({}) do |(name,options), h|
    h[name] = ActiveSupport::Cache.lookup_store(options)
  end
  @options = {}
end

Instance Attribute Details

#storesObject (readonly)

Returns the value of attribute stores.



6
7
8
# File 'lib/active_support/cache/level2.rb', line 6

def stores
  @stores
end

Instance Method Details

#cleanup(*args) ⇒ Object



16
17
18
19
20
# File 'lib/active_support/cache/level2.rb', line 16

def cleanup(*args)
  @lock.synchronize do
    @stores.each_value { |s| s.cleanup(*args) }
  end
end

#clear(*args) ⇒ Object



22
23
24
25
26
# File 'lib/active_support/cache/level2.rb', line 22

def clear(*args)
  @lock.synchronize do
    @stores.each_value { |s| s.clear(*args) }
  end
end