Sha256: a17e1038ffbabf2989ac8f6a0258e43cad25348ab3a335ae2d9cad4c12fc9dcd
Contents?: true
Size: 714 Bytes
Versions: 8
Compression:
Stored size: 714 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, options = {}) @app = app @cache = options.fetch(:cache) { Routemaster::Cache.new } @client = options.fetch(:client) { Routemaster::Jobs::Client.new } @queue = options.fetch(:queue) { Config.queue_name } end def call(env) env.fetch('routemaster.dirty', []).each do |url| @client.enqueue(@queue, Routemaster::Jobs::CacheAndSweep, url) end @app.call(env) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems