Sha256: 62719acc2821429f81d3019cb7a23eda562370f323f8d2aaff56a6bc1316ebef

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 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
            true # nothing to cache, remove the element from dirty
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
routemaster-drain-2.5.1 lib/routemaster/jobs/cache_and_sweep.rb