Junior REST API

What is the cacheability principle in REST?

Responses from the server should indicate whether they are cacheable or not, to improve

performance and scalability. Clients and intermediaries can reuse cached responses.

👉 Example in ASP.NET Core:

[HttpGet("products")]

[ResponseCache(Duration = 60)] // Cache for 60 seconds

public IActionResult GetProducts()

return Ok(new[] { "Laptop", "Mouse", "Keyboard" });

More from ASP.NET Core Web API Tutorial

All questions for this course