Class: ActiveSupport::Cache::Level2
- Inherits:
-
Store
- Object
- Store
- ActiveSupport::Cache::Level2
- Defined in:
- lib/active_support/cache/level2.rb
Instance Attribute Summary collapse
-
#stores ⇒ Object
readonly
Returns the value of attribute stores.
Class Method Summary collapse
-
.instrument ⇒ Object
Rails 3 doesn’t instrument by default, this overrides it.
Instance Method Summary collapse
- #cleanup(*args) ⇒ Object
- #clear(*args) ⇒ Object
-
#initialize(store_options) ⇒ Level2
constructor
A new instance of Level2.
- #read_multi(*names) ⇒ Object
Constructor Details
#initialize(store_options) ⇒ Level2
14 15 16 17 18 19 |
# File 'lib/active_support/cache/level2.rb', line 14 def initialize() @stores = .each_with_object({}) do |(name,), h| h[name] = ActiveSupport::Cache.lookup_store() end = {} end |
Instance Attribute Details
#stores ⇒ Object (readonly)
Returns the value of attribute stores.
12 13 14 |
# File 'lib/active_support/cache/level2.rb', line 12 def stores @stores end |
Class Method Details
.instrument ⇒ Object
Rails 3 doesn’t instrument by default, this overrides it
40 41 42 |
# File 'lib/active_support/cache/level2.rb', line 40 def self.instrument true end |
Instance Method Details
#cleanup(*args) ⇒ Object
21 22 23 |
# File 'lib/active_support/cache/level2.rb', line 21 def cleanup(*args) @stores.each_value { |s| s.cleanup(*args) } end |
#clear(*args) ⇒ Object
25 26 27 |
# File 'lib/active_support/cache/level2.rb', line 25 def clear(*args) @stores.each_value { |s| s.clear(*args) } end |
#read_multi(*names) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/active_support/cache/level2.rb', line 29 def read_multi(*names) result = {} @stores.each do |_name,store| data = store.read_multi(*names) result.merge! data names -= data.keys end result end |