Response caching, in web APIs and web applications is a complex topic, and can refer to many related mechanisms, lets be clear on the main mechanisms involved:
- HTTP response headers, defined by the server on responses. (This is not actually caching, rather an instruction for a client)
- Output caches on the server controlled by the server, used to serve responses (usually per unique request, varying by all parameters, path and query)
- HTTP client caching, where clients/intermediaries act on the declared HTTP response headers from server (usually performed by intermediary infrastructure)
- Client application caching, where clients (like JavaScript frameworks) maintain their own caches in the browser, to prevent themselves reissuing requests to servers.
These are the most common types, there might be others.
All these mechanisms are in play at all times, and are all orthogonal and mutually exclusive to each other.
Which means we need to take great care to manage them or coordinate them with other mechanisms that may also be in play.
Caching is also (one of those things) that is optional until it is needed, and then great care should be applied since cache invalidation is a huge problem to deal with, particularly with usability when it comes to volatile data.
Response caching, in web APIs and web applications is a complex topic, and can refer to many related mechanisms, lets be clear on the main mechanisms involved:
All these mechanisms are in play at all times, and are all orthogonal and mutually exclusive to each other.
Which means we need to take great care to manage them or coordinate them with other mechanisms that may also be in play.
Caching is also (one of those things) that is optional until it is needed, and then great care should be applied since cache invalidation is a huge problem to deal with, particularly with usability when it comes to volatile data.