If you just want to clear the cache once, you can use this:
foreach ( System.Collections.DictionaryEntry entry in HttpContext.Current.Cache )
HttpContext.Current.Cache.Remove( entry.Key as String );
Otherwise, @Anton Gogolev's solution is great for preventing new entries.
source
share