Caching RESTful web API results
The ability to cache and reuse previously retrieved resources is very essential for improving the performance of a REST application. The HTTP/1.1 protocol specification provides a number of features to facilitate the caching of network resources. These offerings can be leveraged for improving the performance of the RESTful web APIs accessed over the HTTP protocol.
HTTP Cache-Control directive
The HTTP Cache-Control
directive defines the HTTP response caching policies. You can use it for enabling the caching of the RESTful web API results for a specified interval. Here is a quick summary of the important HTTP Cache-Control
directives:
HTTP Cache-Control directive | Description |
| In this directive, public resources can be cached by the client and all intermediate public proxies. |
| In this directive, private resources can be cached only by the client. |
| This directive specifies how long a resource cached on the client is valid (measured in seconds). |
|