# encoding: utf-8 require 'faraday' module Github module Request class Caching < Faraday::Middleware attr_reader :cache def initialize(app, cache = nil, options={}) super(app) @cache = cache || Proc.new{}.call end def call(env) if env[:method] == :get # TODO choose cache method # file_store # mem_cache_store # memory_store else @app.call(env) end end def cache_key url = env[:url].dup if url.query end end end end # Request end # Github