Posts

Showing posts from October, 2018

REST API Caching

REST APIs being exposed over HTTP mainly, there is a great advantage for APIs through HTTP Caching. Why caching is important for REST APIs?  Reduced server load, Low response time Save bandwidth The biggest gain through caching for REST APIs is reduced server load, because the clients can store a cached response for sometime in their local store and access it without hitting the server. So it will result in a low response time to the client making things faster for them. Further, using E-tags (Entity tags), clients have the ability to check with the server whether the response has updated or not. The response body is sent to the client only if the response has changed from what client has cached. Otherwise a 304 Not-Modified response is sent without a response body.  We'll discuss about ETags more later in this post. What to cache?  In your REST API, there can be data that doesn't change more frequently and also data that changes frequently. We can defin