Web Technology Basics
The response for a "my page" whose content differs for each user is given Cache-Control: private, max-age=60. Which of the following correctly describes the effect of this setting?
- AOnly shared caches such as a CDN reuse it for 60 seconds, and the user's browser cache does not store it
- BThe browser cache can reuse it as is for 60 seconds, but shared caches such as a CDN or a proxy do not store it
- CIt is not stored in any cache, so even the browser fetches it from the server again every time
Show answer and explanation
Answer: B. The browser cache can reuse it as is for 60 seconds, but shared caches such as a CDN or a proxy do not store it
A browser cache is used by a single user only, whereas the caches of a CDN or a proxy are shared by many users. private indicates that the response must not be stored in shared caches, and max-age=60 indicates that for 60 seconds after storing, it may be used without checking with the server. If per-user pages were stored in a CDN, it could lead to accidents in which other users are shown someone else's information. To have a response stored nowhere, no-store is used, and to allow storing but require a check with the server on each use, no-cache is used.
- A. private prevents storage in shared caches; it is the user's browser cache that can store it.
- B. Correct. The browser can use it for 60 seconds without checking with the server, but shared caches do not store it.
- C. The setting that prevents storage anywhere is no-store. With private, the response is stored in the browser cache.