class Routemaster::Jobs::CacheAndSweep

Caches a URL using {Cache} and sweeps the dirty map if successful. Busts the cache if the resource was deleted.

Public Instance Methods

perform(url) click to toggle source
# File lib/routemaster/jobs/cache_and_sweep.rb, line 9
def perform(url)
  Dirty::Map.new.sweep_one(url) do
    begin
      cache.get(url)
    rescue Errors::ResourceNotFound
      cache.bust(url)
      true
    end
  end
end

Private Instance Methods

cache() click to toggle source
# File lib/routemaster/jobs/cache_and_sweep.rb, line 22
def cache
  @cache ||= Routemaster::Cache.new
end