Hello,
I cannot clear the cache using the code below.
using System.Web.Helpers;
//set cache
WebCache.Set("myCacheKey", "cacheValue_1"); //<<--static key pairfor (int x = 0 ; x = 10; x++) { WebCache.Set("key_" + x, "value_" + x); //<<--dynamic key pairs}
//clear cache
var q = from p in HttpRuntime.Cache.Cast<System.Collections.DictionaryEntry>()
select p;
foreach (var item in q)
{
HttpRuntime.Cache.Remove(item.Key.ToString());
}
//get cachestring cacheValDynamic = WebCache.Get("key_" + 5) //<<---suppose to be null :(
string cacheVal = WebCache.Get("myCacheKey"); //<<---there's still cache value :(, suppose to be null Go to the complete details ...