Class: Layercake::Store
- Inherits:
-
ActiveSupport::Cache::Store
- Object
- ActiveSupport::Cache::Store
- Layercake::Store
- Defined in:
- lib/layercake/store.rb
Instance Attribute Summary collapse
-
#stores ⇒ Object
readonly
Returns the value of attribute stores.
Instance Method Summary collapse
- #cleanup(options = nil) ⇒ Object
- #clear(options = nil) ⇒ Object
- #decrement(name, amount = 1, options = nil) ⇒ Object
- #delete_matched(matcher, options = nil) ⇒ Object
- #increment(name, amount = 1, options = nil) ⇒ Object
-
#initialize(*args) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(*args) ⇒ Store
Returns a new instance of Store.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/layercake/store.rb', line 6 def initialize(*args) = args. super() @stores = [] args.each do |arg| initialize_store(arg) end end |
Instance Attribute Details
#stores ⇒ Object (readonly)
Returns the value of attribute stores.
4 5 6 |
# File 'lib/layercake/store.rb', line 4 def stores @stores end |
Instance Method Details
#cleanup(options = nil) ⇒ Object
23 24 25 |
# File 'lib/layercake/store.rb', line 23 def cleanup( = nil) @stores.each{|store| store.cleanup()} end |
#clear(options = nil) ⇒ Object
19 20 21 |
# File 'lib/layercake/store.rb', line 19 def clear( = nil) @stores.each{|store| store.clear() } end |
#decrement(name, amount = 1, options = nil) ⇒ Object
31 32 33 |
# File 'lib/layercake/store.rb', line 31 def decrement(name, amount = 1, = nil) @stores.map{|store| store.decrement(name, amount, )}.first end |
#delete_matched(matcher, options = nil) ⇒ Object
35 36 37 |
# File 'lib/layercake/store.rb', line 35 def delete_matched(matcher, = nil) @stores.each{|store| store.delete_matched(matcher, )} end |
#increment(name, amount = 1, options = nil) ⇒ Object
27 28 29 |
# File 'lib/layercake/store.rb', line 27 def increment(name, amount = 1, = nil) @stores.map{|store| store.increment(name, amount, )}.first end |