O'Reilly logo

RESTful Web API Design with Node.js by Valentin Bojinov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Caching

When we discussed the REST principles defined by Roy Fielding, we mentioned that caching was a rather sensitive topic. In the end, our consumers would expect up-to-date results when executing a query. However, from a statistical point of view, data exposed in the web is more likely to be read rather than updated or deleted.

So it is reasonable that a resource exposed by a public URI becomes a subject of millions of requests, considering taking off part of the load from the server to a cache. The HTTP protocol allows us to cache responses for a given period of time. For instance, when multiple requests are received in a short period of time, querying for contacts of a given group such as /contacts?groups=Dev, our service could utilize special ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required