I want to add Memory Cache into .NET Api, but when i send request, changing the value from the body request does not refresh the endpoint call.
My API endpoint:
[HttpGet]
[Route("api/v1/studies")]
[ResponseCache(Duration = 30, Location = ResponseCacheLocation.Any)]
public async Task<IActionResult> Get(GetStudiesQuery query)
{
var result = await Mediator.Send(query);
return Ok(result);
}
When i first time call request:
GET /api/v1/studies HTTP/1.1
Host: localhost:7093
Content-Type: application/json
Content-Length: 27
{
"city": "London"
}
I got response not from memory cache. If i call second time this same request, i got response from memory Cache. But when i change body value, I am also getting values from the memory cache, although the result should be updated.
GET /api/v1/studies HTTP/1.1
Host: localhost:7093
Content-Type: application/json
Content-Length: 27
{
"city": "New York"
}