Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MahdiKarimipour/92aad205998a734bd8a2259c2d33c1c4 to your computer and use it in GitHub Desktop.
Save MahdiKarimipour/92aad205998a734bd8a2259c2d33c1c4 to your computer and use it in GitHub Desktop.
Asp.NET Response Caching at the End Point Level
[HttpGet("product")]
[MapToApiVersion("1")]
[ResponseCache(VaryByQueryKeys = new[] { "field", "category" }, Duration = 10 * 60)]
public async Task<ActionResult<IEnumerable<ProductViewModel>>> GetProducts(
[FromQuery] string field,
[FromQuery] string category)
{
return Ok(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment