Class: Layercake::Store

Inherits:
ActiveSupport::Cache::Store
  • Object
show all
Defined in:
lib/layercake/store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Store

Returns a new instance of Store.



6
7
8
9
10
11
12
13
# File 'lib/layercake/store.rb', line 6

def initialize(*args)
  super()
  @stores = []
  
  args.each do |arg|
    initialize_store(arg)
  end
end

Instance Attribute Details

#storesObject (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



20
21
22
# File 'lib/layercake/store.rb', line 20

def cleanup(options = nil)
  @stores.each{|store| store.cleanup(options)}
end

#clear(options = nil) ⇒ Object



16
17
18
# File 'lib/layercake/store.rb', line 16

def clear(options = nil)
  @stores.each{|store| store.clear(options) }
end

#decrement(name, amount = 1, options = nil) ⇒ Object



28
29
30
# File 'lib/layercake/store.rb', line 28

def decrement(name, amount = 1, options = nil)
  @stores.map{|store| store.decrement(name, amount, options)}.first
end

#delete_matched(matcher, options = nil) ⇒ Object



32
33
34
# File 'lib/layercake/store.rb', line 32

def delete_matched(matcher, options = nil)
  @stores.each{|store| store.delete_matched(matcher, options)}
end

#increment(name, amount = 1, options = nil) ⇒ Object



24
25
26
# File 'lib/layercake/store.rb', line 24

def increment(name, amount = 1, options = nil)
  @stores.map{|store| store.increment(name, amount, options)}.first
end