# File lib/faraday_middleware/response/caching.rb, line 76
    def cache_on_complete(env)
      key = cache_key(env)
      if cached_response = cache.read(key)
        finalize_response(cached_response, env)
      else
        # response.status is nil at this point, any checks need to be done inside on_complete block
        @app.call(env).on_complete do |response_env|
          store_response_in_cache(key, response_env.response)
          response_env
        end
      end
    end