C
C#6d ago
Kyr

Properly output caching an API

I have a .Net 8 Web API (controllers) and I want to do the following: Cache the output of all successful GET requests (2xx status codes) VaryBy user VaryBy resource (controller) and endpoint (action) VaryBy querystring params (normalised order) When a PUT, POST, PATCH or DELETE on the same resource is successful, clear the GET caches for that controller for the same user Ideally I'd like this to happen automatically without needing me to write additional code in my controller actions each time. I thought I could achieve this with the built in output caching and it feels like it should be possible but I'm striking out on the how and looking for some guidance.
0 Replies
No replies yetBe the first to reply to this messageJoin