The REST resource

In the getUser method, we will pass the right userid to the path variable, assuming the client will pass the userid and get the resource. There are many caching options available to implement. Here, we will use only the If-Modified-Since caching mechanism. As this mechanism will pass the If-Modified-Since value in the header, it will be forwarded to the server, saying that, if the resource is changed after the specified time, get the resource fresh, or else return null.

There are many ways we can implement caching. As our goal is to simplify and convey the message clearly, we will keep the code simple, instead of adding complexity in the code. In order to implement this caching, we might need to add a new variable called ...

Get Building RESTful Web Services with Spring 5 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.