Sha256: d35a5bace962e96daac7b6bd98a7be71933b125dd6684f5258bb2af2ea7b4abd

Contents?: true

Size: 428 Bytes

Versions: 2

Compression:

Stored size: 428 Bytes

Contents

module Rhinestone
  class Server
    takes :http_client, :cache, :later

    def get(path)
      response = cache.get(path)

      unless response
        response = fetch_response(path)
      else
        later.run{ fetch_response(path) }
      end

      return response
    end

    private

    def fetch_response(path)
      response = http_client.get(path)
      cache.set(path, response)
      response
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhinestone-0.0.2 lib/rhinestone/server.rb
rhinestone-0.0.1 lib/rhinestone/server.rb