Sha256: 41b79806aa4dd1ad7b03ab2b0dadcc89a65d3fb9f23cfd86e014af79ce147df6
Contents?: true
Size: 680 Bytes
Versions: 4
Compression:
Stored size: 680 Bytes
Contents
require 'routemaster/cache' require 'routemaster/config' require 'routemaster/jobs/client' require 'routemaster/jobs/cache_and_sweep' 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.bust(url) @client.enqueue(@queue, Routemaster::Jobs::CacheAndSweep, url) end @app.call(env) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems