Browser Cache
Browser Cache is critical to reduce number of requests to server. The concept of caching is simple.When the content client tries to fetch is not modified or updated, then the client uses data from browser. Typically, a browser handles cache by default but we should be aware of it and also still have much space to improve it. You can check what cache exactly looks like on google chrome browser here.
chrome://view-http-cache/
HTTP Header
HTTP Header has directives related to cache such as expired data, modified, private, and so on. Let's take a look at HTTP Header to understand cache.
At first, the client sends request to server and the server sends response with
- Etag
- Cache-Control
Etag
Even if cache is expired, it does not mean content is changed. The client and the server make sure the content is not modified by using Etag.
Cache-Control
no-cache | |
no-transform | |
public | |
private | |
proxy-revalidate | |
max-age |
Etag | |
---|---|
Cache-control | max-age=<number> |