/// <summary>
        /// Conditionally caches the response based on headers
        /// </summary>
        /// <param name="response">The response to cache</param>
        /// <param name="force">Force caching regardless of headers</param>
        /// <returns>True if the response was cached, false if it was ignored</returns>
        public bool CacheResponse(HttpResponseStep response, bool force = false)
        {
            if (!force && response.Headers.ContainsKey("Cache-Control"))
                if (response.Headers["Cache-Control"] == "no-cache")
                    return false;

            var uri = response.Uri.AbsoluteUri;
            if (cache.ContainsKey(uri))
                cache[uri] = response;
            else
                cache.Add(uri, response);

            return true;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Will return false
 /// </summary>
 /// <param name="response"></param>
 /// <param name="force"></param>
 /// <returns></returns>
 public bool CacheResponse(HttpResponseStep response, bool force = false)
 {
     return false;
 }