Removing the output cache in index view while updating in asp.net mvc

I use output caching for some kinds of indexes because they contain a lot of data. I want to keep it specific for each user. because the presentation may differ depending on the roles.

    [OutputCache(Duration = 3600, VaryByParam = "none", Location = OutputCacheLocation.Client)]
    public ActionResult Index(string schooljaarparam) {
        return View(_db.Lesplaatsens.Where(l => l.Schooljaar.Sch_Schooljaar == schooljaarparam).OrderBy(q => q.Lpl_Gemeente).ThenBy(q => q.Lpl_Instelling).ToList());
    }

Now, when someone creates a new item and returns to the Index view. How to remove the index page cache so that the newly created item appears in the list?

I thought this would be a general question, but I have not yet found a solution.

I think you need to use HttpResponse.RemoveOutputCacheItem() but how do I find the route. And where can I see the current cached items in the debugger?

+3
source share
2 answers

, (.. ).

Location = OutputCacheLocation.Client, , , , F5.

+2

Source: https://habr.com/ru/post/1789992/


All Articles