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 ...