Browser caching
The server can ask the browser to cache content on the client machine through the cache-control response header. Having your files cached on the browser has the following advantages:
Quick file retrieval: No need for the browser to access the Internet
Reduced bandwidth costs and reduced processing load on the server: Fewer requests sent by the browser
Great scalability: The greater the traffic, the greater number of browsers caching your data
It also comes with a few disadvantages:
Unpredictable life span: Because other websites compete for the same cache space, the browser can evict your files anytime.
Outdated content: There is no way to update the browser cache if a file is changed on the server. For images, JavaScript, and CSS files, you can solve this by including a version number in the filename, as described in Chapter 12, Reducing Image Load Times and Chapter 13,
Security risk: Because the file is stored on the visitor's computer, an unauthorized person could read...