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