0

My page doesn't change a lot (a change in several days) but when they do, the change must reflect immediately. So for the first part (not changing a lot) it seems wise to use a long duration for ResponseCache but at the other hand as changes must be reflected immediately, forces even not using the caching.

Is there anyway to remove cached response whenever I want to?

Ashkan Mobayen Khiabani
  • 30,915
  • 26
  • 90
  • 147
  • do you want to remove cache response for specific controller action or remove it in ConfigureServices method according to condition? – hasan Jul 05 '17 at 14:05
  • @hsnbl No, actually i found what you said in questions. Imagine that **Index** action is cached, and now there is change in that page. i want to tell the cache to clear cache for **Index** action so that changes apply to output and new one gets cached. and I don't want to just disable caching for it – Ashkan Mobayen Khiabani Jul 05 '17 at 14:09
  • Can you try to use [ResponseCache(Location="Client")] onto your action Reference: https://docs.microsoft.com/en-us/aspnet/core/api/microsoft.aspnetcore.mvc.responsecacheattribute#Microsoft_AspNetCore_Mvc_ResponseCacheAttribute_Location Reference2: https://stackoverflow.com/a/10565986/8175473 – hasan Jul 05 '17 at 14:51
  • Possible duplicate of [Force Cache Refresh When Editing and Redisplaying Content](https://stackoverflow.com/questions/5629299/force-cache-refresh-when-editing-and-redisplaying-content) – gbjbaanb Feb 17 '19 at 18:13

0 Answers0