Class: Startback::Caching::Listeners

Inherits:
Object
  • Object
show all
Defined in:
lib/startback/caching/listeners.rb

Instance Method Summary collapse

Constructor Details

#initializeListeners

Returns a new instance of Listeners.



5
6
7
# File 'lib/startback/caching/listeners.rb', line 5

def initialize
  @listeners = []
end

Instance Method Details

#cache_fail(*args, &bl) ⇒ Object



33
34
35
36
37
# File 'lib/startback/caching/listeners.rb', line 33

def cache_fail(*args, &bl)
  @listeners.each do |l|
    l.cache_fail(*args, &bl)
  end
end

#cache_hit(*args, &bl) ⇒ Object



15
16
17
18
19
# File 'lib/startback/caching/listeners.rb', line 15

def cache_hit(*args, &bl)
  @listeners.each do |l|
    l.cache_hit(*args, &bl)
  end
end

#cache_miss(*args, &bl) ⇒ Object



27
28
29
30
31
# File 'lib/startback/caching/listeners.rb', line 27

def cache_miss(*args, &bl)
  @listeners.each do |l|
    l.cache_miss(*args, &bl)
  end
end

#cache_outdated(*args, &bl) ⇒ Object



21
22
23
24
25
# File 'lib/startback/caching/listeners.rb', line 21

def cache_outdated(*args, &bl)
  @listeners.each do |l|
    l.cache_outdated(*args, &bl)
  end
end

#register(listener) ⇒ Object Also known as: <<



9
10
11
12
# File 'lib/startback/caching/listeners.rb', line 9

def register(listener)
  @listeners << listener
  self
end