How does a cache work?
RFC 9111, which defines HTTP caching, describes a cache as local storage for response messages plus the logic that controls storing, retrieving and deleting them. Its purpose is to reduce response time and network bandwidth for later matching requests [1]. As MDN puts it, reusing a stored response means the origin server does not have to be contacted, so responses arrive faster and the server carries less load [2].
When does cached data go stale?
A stored HTTP response is either fresh or stale. A fresh response can still be reused; a stale one has expired [2]. A concrete example: Cache-Control: max-age=604800 says the response stays fresh for one week. A shared cache that has held it for a day adds Age: 86400, and the client then treats it as fresh for the remaining 518400 seconds [2].
DNS follows the same logic. Every record's TTL states how long it may be cached, and a value of zero means it can only be used for the transaction in progress [3].
What is the difference between a private and a shared cache?
A private cache is dedicated to a single user and is usually built into the browser. A shared cache serves stored responses to more than one user and typically sits inside an intermediary [1]. The difference matters for personal data: MDN recommends Cache-Control: private for personalised responses and warns that a cookie alone does not make a response private [2].