Sha256: 83966c5659f46dbfd9297d2c565ff596240f7791ae1664f708cd23c1ac2d270f

Contents?: true

Size: 612 Bytes

Versions: 20

Compression:

Stored size: 612 Bytes

Contents

# 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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
github_api-0.4.8 lib/github_api/request/caching.rb
github_api-0.4.7 lib/github_api/request/caching.rb
github_api-0.4.6 lib/github_api/request/caching.rb
github_api-0.4.5 lib/github_api/request/caching.rb
github_api-0.4.4 lib/github_api/request/caching.rb
github_api-0.4.3 lib/github_api/request/caching.rb
github_api-0.4.2 lib/github_api/request/caching.rb
github_api-0.4.1 lib/github_api/request/caching.rb
github_api-0.4.0 lib/github_api/request/caching.rb
github_api-0.3.9 lib/github_api/request/caching.rb
github_api-0.3.8 lib/github_api/request/caching.rb
github_api-0.3.7 lib/github_api/request/caching.rb
github_api-0.3.6 lib/github_api/request/caching.rb
github_api-0.3.4 lib/github_api/request/caching.rb
github_api-0.3.3 lib/github_api/request/caching.rb
github_api-0.3.2 lib/github_api/request/caching.rb
github_api-0.3.1 lib/github_api/request/caching.rb
github_api-0.3.0 lib/github_api/request/caching.rb
github_api-0.2.2 lib/github_api/request/caching.rb
github_api-0.2.1 lib/github_api/request/caching.rb