- Home
- API Design
- What Is the Cache-Control Head ...

Cache control is an HTTP header used to specify browser caching policies. The Cache-Control header that specifies the caching policies of server responses as well as client requests. Cache-control it gives information about the manner in which a resource is cached, location of the cached resource, and its maximum age attained before getting expired i.e. time to live.
The following example of the HTTP Response Header from www.apitier.com

The Hypertext Transfer Protocol (HTTP) outlines the syntax for communications on the World Wide Web, and this communication consists of requests from clients to servers and responses from servers back to clients. These HTTP requests and responses each come stamped with a series of key-value pairs called headers.
Cache-Control: <directive> [, <directive>]*
The no-cache directive indicates that the response can be stored in caches without any restriction even if it is non-cacheable. But the response must be validated with the origin server before each reuse, even when the cache is disconnected from the origin server.
The no-store directive indicates that the response cannot be stored by any cache. This is usually used for sensitive data, such as personal banking details.
The max-age request directive defines in seconds. It indicates the response remains fresh until N seconds after the response is generated.
The public response directive indicates that the response can be stored by any cache without any restriction. In case the response is non-cacheable, it can still be cached.
The private response directive indicates that the only browser cache is eligible to store the response.
A response with a ‘private’ directive can only be cached by the client and never by an intermediary agent, For example CDN or a proxy. These are often resources containing private data, such as a website displaying a user’s personal information.
Browser caching is when a web browser saves website resources so it doesn’t have to fetch them again from a server. For example, a background image on a website might be saved locally in cache so that when a user visits that page for the second time, the image will load from the user’s local files and the page will load much faster.
Browsers will only store these resources for a specified period of time, known as the Time To Live (TTL).