Programmatically clear cache profile in asp.net core

后端 未结 1 746
鱼传尺愫
鱼传尺愫 2021-01-13 17:14

I have setup a cache profile in my asp.net core web api as follows:

services.AddMvc(options => {
     // Cache profile for lookup data will expire every 1         


        
相关标签:
1条回答
  • 2021-01-13 17:39

    You cannot really clear that cache, because it's not server but client cache. ResponseCache attribute will just set certain headers in response. Simplified description of how this works: browser (or any intermediate proxy) making request to your api notice those response headers, sees that this response is valid for 15 minutes and so will not repeat that request for the next 15 minutes instead taking it from its local cache. Since you have no control over that local cache - you cannot clear it.

    0 讨论(0)
提交回复
热议问题