Http Caching for Web API Responses

Posted on

A Web API serves a client e.g. browser with an HTTP response upon receiving an HTTP request. Sometimes these responses could be huge size wise and this can lead to delays in displaying the response to the user. To cater such things, almost all the web browsers (Chrome, IE, Mozilla) have built-in capabilities to cache the http responses for a given timespan. A cache is an in memory store for data which is used to improve the performance. Read more about cache… Caching of a response at the browser is not automatic. In the response headers we have to raise max-age or expires flag to tell the browser, it has to cache the response for a given timespan. Until this cache remains valid, browser picks data from cached response rather going back to the server again. Validity of browser’s cache depends on the value of max-age or expires headers. You […]