catchy phrases dating headlines - Invalidating the cache
The modern day developer has a wide variety of techniques and technologies available to improve application performance and end-user experience.One of the most frequently overlooked technologies is that of the HTTP cache.HTTP caching is a universally adopted specification across all modern web browsers, making its implementation in web applications simple.
It is intuitive to think about the end-user’s browser as the primary consumer of HTTP cache headers.
However, these HTTP cache headers are available to be, and are acted upon by, every intermediate proxy and cache between the source server and the end user.
header is the most important header to set as it effectively ‘switches on’ caching in the browser.
When an item is fully cached, the browser may choose to not contact the server at all and simply use its own cached copy: For instance, once CSS stylesheets from your application are downloaded by the browser there’s no need to download them again during the user’s session.
In these instances it is beneficial for the users browser to cache this file locally, and use that copy whenever the resource is requested again.
An application using HTTP cache headers is able to control this caching behavior and alleviate server-side load.
However, incorrect caching can cause users to see out-of-date content and hard to debug issues.
This article discusses the specifics of HTTP caching and in what scenarios to employ an HTTP cache header based strategy.
HTTP caching occurs when the browser stores local copies of web resources for faster retrieval the next time the resource is required.
As your application serves resources it can attach cache headers to the response specifying the desired cache behavior.