Class: Primer::Worker::ChangesAgent

Inherits:
Agent
  • Object
show all
Defined in:
lib/primer/worker/changes_agent.rb

Instance Method Summary collapse

Methods inherited from Agent

run!, #run!, topic

Instance Method Details

#on_message(attribute) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/primer/worker/changes_agent.rb', line 7

def on_message(attribute)
  cache = Primer.cache
  cache.keys_for_attribute(attribute).each do |cache_key|
    block = lambda do
      cache.invalidate(cache_key)
      cache.regenerate(cache_key)
    end
    cache.throttle ? cache.timeout(cache_key, &block) : block.call
  end
end