1

I am creating a http client cache, but I have a doubt about the no-cache field.

Official documentation says:

If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server. [...]

If the no-cache directive does specify one or more field-names, then a cache MAY use the response to satisfy a subsequent request, subject to any other restrictions on caching. However, the specified field-name(s) MUST NOT be sent in the response to a subsequent request without successful revalidation with the origin server.

My question is: how can I revalidate just those fields without revalidating the whole response?

Community
  • 1
  • 1
Massimo
  • 3,436
  • 4
  • 40
  • 68

1 Answers1

1

You should send a conditional request to the origin server and use the returned (header) fields when you get a 304 Not Modified

simonmenke
  • 2,819
  • 19
  • 28
  • Then, what you say is to do the same request as if there were not field names in the no-cache attribute, and take just those fields when I receive 304 Not Modified? – Massimo Oct 26 '12 at 10:30
  • Correct. but you might also get back a '2XX OK' in which case you have to consider the response as a new entity. – simonmenke Oct 26 '12 at 10:31