Sha256: e702d79f66706b5466a04b7a4c322f7477d2d7f966d839d8d332985b2c02f516
Contents?: true
Size: 716 Bytes
Versions: 5
Compression:
Stored size: 716 Bytes
Contents
require 'routemaster/cache' require 'routemaster/config' require 'routemaster/jobs/client' require 'routemaster/jobs/cache_and_sweep' require 'routemaster/event_index' module Routemaster module Middleware class Cache def initialize(app, cache:nil, client:nil, queue:nil) @app = app @cache = cache || Routemaster::Cache.new @client = client || Routemaster::Jobs::Client.new @queue = queue || Config.queue_name end def call(env) env.fetch('routemaster.dirty', []).each do |url| @cache.invalidate(url) @client.enqueue(@queue, Routemaster::Jobs::CacheAndSweep, url) end @app.call(env) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems