Sha256: 222f6624216c9ac9d01c572797c18c3c3b6dc3655f3619588897a5a84262f98d
Contents?: true
Size: 643 Bytes
Versions: 6
Compression:
Stored size: 643 Bytes
Contents
require 'routemaster/cache' require 'routemaster/config' require 'routemaster/jobs/cache_and_sweep' require 'resque' module Routemaster module Middleware class Cache def initialize(app, cache:nil, resque:nil, queue:nil) @app = app @cache = cache || Routemaster::Cache.new @resque = resque || Resque @queue = queue || Config.queue_name end def call(env) env.fetch('routemaster.dirty', []).each do |url| @cache.bust(url) @resque.enqueue_to(@queue, Routemaster::Jobs::CacheAndSweep, url) end @app.call(env) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems