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
14
15
16
# File 'lib/layercake/store.rb', line 6

def initialize(*args)
  options = args.extract_options!
  super(options)
  
  @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



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

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

#clear(options = nil) ⇒ Object



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

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

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



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

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

#delete_matched(matcher, options = nil) ⇒ Object



35
36
37
# File 'lib/layercake/store.rb', line 35

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

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



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

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