ASP.NET MVC. How to clear values ​​cached using [OutputCacheAttribute]

I am using [OutputCacheAttribute] to cache some actions. Everything is working fine. Let's say I set its Duration property to 1 hour. But I want to clear the cached values. Is it possible?

0
caching asp.net-mvc
Aug 19 '11 at 5:13
source share
1 answer

Looking at the source code of [OutputCacheAttribute], it seems that the only possible solution is to implement a new class obtained from MemoryCache and set its property OutputCacheAttribute.ChildActionCache. This class will use some custom prefix for all cached keys, so it will be pretty easy for me to find them (and then remove them from the cache).

+1
Aug 19 '11 at 5:16
source share



All Articles