Sha256: b78cec3bbce9346247badbb5ed29553771013ba8d2f02a38a8967de07a7a4984
Contents?: true
Size: 663 Bytes
Versions: 18
Compression:
Stored size: 663 Bytes
Contents
# frozen_string_literal: true module Frodo class Middleware::Caching < FaradayMiddleware::Caching def call(env) expire(cache_key(env)) unless use_cache? super end def expire(key) cache&.delete(key) end # We don't want to cache requests for different clients, so append the # oauth token to the cache key. def cache_key(env) super(env) + hashed_auth_header(env) end def use_cache? @options.fetch(:use_cache, true) end def hashed_auth_header(env) Digest::SHA1.hexdigest( env[:request_headers][Restforce::Middleware::Authorization::AUTH_HEADER] ) end end end
Version data entries
18 entries across 18 versions & 1 rubygems