Sha256: bbef11405ecfa6d712b8e5d59a70ac959e2047f655934f388befb81cc8edec2d

Contents?: true

Size: 650 Bytes

Versions: 36

Compression:

Stored size: 650 Bytes

Contents

require 'net/http'

class HttpEvictCache < Filbunke::Callbacks

  def on_update(file, local_file_path)
    begin
      evict_http = Net::HTTP.new(@config["host"], @config["port"].to_i)
      evict_http.start do |http|
        evict_path = "/cache/evict/#{file.path.chomp('.yml')}"
        request = Net::HTTP::Get.new(evict_path)
        response = http.request(request)
        if response.code.to_i != 200
          @logger.log "Failed to evict cache entry: #{file.path}"
        end
      end
    rescue StandardError => e
      @logger.log("Failed to evict cache entry: #{file.path}")
      @logger.log(e.backtrace.join("\n"))
    end
  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
filbunke-2.1.7 doc/examples/http_evict_cache.rb
filbunke-2.1.6 doc/examples/http_evict_cache.rb
filbunke-2.1.4 doc/examples/http_evict_cache.rb
filbunke-1.13.5 doc/examples/http_evict_cache.rb
filbunke-1.13.4 doc/examples/http_evict_cache.rb
filbunke-2.1.3 doc/examples/http_evict_cache.rb
filbunke-2.1.2 doc/examples/http_evict_cache.rb
filbunke-1.13.3 doc/examples/http_evict_cache.rb
filbunke-1.13.2 doc/examples/http_evict_cache.rb
filbunke-1.13.1 doc/examples/http_evict_cache.rb
filbunke-2.1.0 doc/examples/http_evict_cache.rb
filbunke-1.13.0 doc/examples/http_evict_cache.rb
filbunke-1.12.0 doc/examples/http_evict_cache.rb
filbunke-1.11.9 doc/examples/http_evict_cache.rb
filbunke-2.0.9 doc/examples/http_evict_cache.rb
filbunke-1.11.8 doc/examples/http_evict_cache.rb
filbunke-2.0.8 doc/examples/http_evict_cache.rb
filbunke-2.0.6 doc/examples/http_evict_cache.rb
filbunke-1.11.6 doc/examples/http_evict_cache.rb
filbunke-2.0.2 doc/examples/http_evict_cache.rb