Clear output cache in MVC 6 / ASP.NET 5

I have html fragments in a partial view that uses the output cache this way

 <cache vary-by="@Util.SomeID" expires-after="@TimeSpan.FromHours(1)">
     <div>some content</div>
 </cache>

If it is necessary to update the contents before the cache expires, how can I intercept the cache for this particular fragment (or, if necessary, the entire cache)?

I am using ASP.NET 5 and MVC 6 ..

Thank!

+4
source share
2 answers

There is IMemoryCacheno way to clear the cache in the interface . Otherwise, you can enter it IMemoryCacheon your controller or where you need it and call the method.

aspnet .

CacheManager MVC Core , , , , ...

+1

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


All Articles