I have been struggling with this question for several days.
What is the age of an object stored in a cache. In particular, I am wondering about Cloud Front. If I specify
Cache-Control: max-age=60, public
when I upload it at T = N, and then 10 minutes go by, is the official age of my entity 600 seconds? In other words, is the age of an entity NOW - T?
For example, if I push a file into S3 with an expiration date of 30 minutes, and then I do not push a new version of it for for 1 week, will Cloud Front re-validate (GET If-Modified-Since) that entity on every request? Or will it re-validate the entity every 30 minutes and set the age back to 0 after each re-validation?
I have looked here for a definition of age, but I am not quite sure what the answer is:
The max-age
directive specifies the time, in seconds, after which the client should consider that the content at the given URL is invalid.
This means that if you have a max-age of 10 minutes, get the resource at instant t, then if you need the content at t + 9 minutes for instance, it will not be fetched. But its expiry date remains unchanged on the client side.
Which means at any instant after t + 10 minutes, the content will be fetched again, and its expiry time recalculated (since it may have changed in the meanwhile).
At least, that is how clients should operate.
max-age=0 is the equivalent of "always fetch that resource again".