Sha256: 2d1a7215b6efbc291ff153a0df794c981a0bc3d8e22da42f22e675f996069dd5

Contents?: true

Size: 452 Bytes

Versions: 6

Compression:

Stored size: 452 Bytes

Contents

require 'routemaster/cache'
require 'routemaster/dirty/map'

module Routemaster
  module Jobs
    # Caches a URL using {Cache}, and sweeps the dirty map
    # if sucessful.
    class CacheAndSweep
      def perform(url)
        Dirty::Map.new.sweep_one(url) do
          begin
            Routemaster::Cache.new.get(url)
          rescue Errors::ResourceNotFound
            nil # nothing to cache
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
routemaster-drain-2.5.0 lib/routemaster/jobs/cache_and_sweep.rb
routemaster-drain-2.4.4 lib/routemaster/jobs/cache_and_sweep.rb
routemaster-drain-2.4.3 lib/routemaster/jobs/cache_and_sweep.rb
routemaster-drain-2.4.2 lib/routemaster/jobs/cache_and_sweep.rb
routemaster-drain-2.4.1 lib/routemaster/jobs/cache_and_sweep.rb
routemaster-drain-2.4.0 lib/routemaster/jobs/cache_and_sweep.rb