What is the 'cacheability' constraint in REST, and how does it influence API design?
Last updated
Responses must declare whether and how long they can be cached, via
Cache-Control(max-age,no-store,private,public). Validators likeETagallow cheap revalidation with a 304.Design impact: use safe, idempotent
GETwith stable URIs for cacheable data, and mark user-specific or sensitive dataprivateorno-store.Benefits: fewer round trips, lower server load, and reuse by CDNs and proxies.
- https://www.freecodecamp.org/news/what-is-a-rest-api/
- https://dev.to/codewithved/how-would-you-consider-your-api-to-be-restful-5g3c
- https://www.freecodecamp.org/news/restful-services-part-ii-constraints-and-goals-530b8f6298b9/
- https://dev.to/rinonten/demystifying-rest-apis-4o2l
- https://beyond-technology2014.medium.com/rest-apis-and-architectural-constraints-5d2b51fec490