class Routemaster::Middleware::ExpireCache
Public Class Methods
new(app, options = {})
click to toggle source
# File lib/routemaster/middleware/expire_cache.rb, line 6 def initialize(app, options = {}) @app = app @cache = options.fetch(:cache) { Routemaster::Cache.new } end
Public Instance Methods
call(env)
click to toggle source
# File lib/routemaster/middleware/expire_cache.rb, line 11 def call(env) env.fetch('routemaster.payload', []).each do |event| next if event['type'] == 'noop' @cache.invalidate(event['url']) end @app.call(env) end