Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1223

Cache could be more aggressive on cache invalidations from Content-Location

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.2.1
    • 4.2.2, 4.3 Final
    • HttpCache
    • None

    Description

      When a response to a PUT, POST, or DELETE carries a Content-Location header, there are certain cases where the cache MUST invalidate its entry for the URI in the Content-Location header, namely:
      1. If the Date on the response is later than the Date on the entry; OR
      2. If the Etag on the response is different than the one on the entry.

      The tricky bit is when the Dates match, as it isn't a priori clear which is more up-to-date, as responses can be received out-of-order. Right now the caching client errs on the side of caching things and relying on the Cache-Control semantics of the existing entry to specify freshness. I'm wondering if this isn't the wrong tradeoff, as the cache is receiving the response after the entry already exists, so there is a strong likelihood that the response is actually fresher (even though we can't tell due to the 1-second granularity of the Date headers) and we probably ought to invalidate in this case.

      The HTTP/1.1 spec does not require one behavior or the other (both are compliant – I have a patch with this behavior that passes all the ProtocolRequirements/Recommendations unit tests), so this is listed as an improvement. I'll upload a patch shortly.

      Attachments

        Activity

          People

            jonm Jonathan Moore
            jonm Jonathan Moore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: