I found the following blog post on caching interesting. See reference [1]
I like caching, but I understand there's a very real danger of seeing outdated results. The Blogpost highlights this quite good.
HTTP Caching has several great options, apparently:
- Expired Header (HTTP 1.0) - ResponseBuilder.expires
- Cache-Control Header (HTTP 1.1) - CacheControl class for more control
- ETags - EntityTag class, indicates a kind of hashcode to verify if a Resource has changed, without actually accessing the resource
Nice.
References
- [1] Caching REST Resources In Jakarta REST (formerly JAX-RS)
- https://blog.payara.fish/caching-rest-resources-in-jakarta-rest-formerly-jax-rs?hs_preview=dxtFzcIy-164496731149