Sha256: 04bcbb02329cf943472a2542c725e3e8f15496aa8eae780714d722442776d8df

Contents?: true

Size: 633 Bytes

Versions: 26

Compression:

Stored size: 633 Bytes

Contents

require 'net/http'

class HttpEvictCache < Filbunke::Callbacks

  def on_update(file)
    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

26 entries across 26 versions & 1 rubygems

Version Path
filbunke-1.6.0 doc/examples/http_evict_cache.rb
filbunke-1.5.3 doc/examples/http_evict_cache.rb
filbunke-1.5.2 doc/examples/http_evict_cache.rb
filbunke-1.5.1 doc/examples/http_evict_cache.rb
filbunke-1.5.0 doc/examples/http_evict_cache.rb
filbunke-1.4.1 doc/examples/http_evict_cache.rb
filbunke-1.4.0 doc/examples/http_evict_cache.rb
filbunke-1.3.0 doc/examples/http_evict_cache.rb
filbunke-1.2.1 doc/examples/http_evict_cache.rb
filbunke-1.2.0 doc/examples/http_evict_cache.rb
filbunke-1.1.15 doc/examples/http_evict_cache.rb
filbunke-1.1.14 doc/examples/http_evict_cache.rb
filbunke-1.1.13 doc/examples/http_evict_cache.rb
filbunke-1.1.12 doc/examples/http_evict_cache.rb
filbunke-1.1.11 doc/examples/http_evict_cache.rb
filbunke-1.1.10 doc/examples/http_evict_cache.rb
filbunke-1.1.9 doc/examples/http_evict_cache.rb
filbunke-1.1.8 doc/examples/http_evict_cache.rb
filbunke-1.1.7 doc/examples/http_evict_cache.rb
filbunke-1.1.6 doc/examples/http_evict_cache.rb