Sometimes you need to clear all the cached
from the browser in ASP.NET application in order to save new entry is available
in the cache.
The method you use is actually clear your cache.
public
void ClearCacheItems()
{
List<string>
keys = new List<string>();
IDictionaryEnumerator enumerator =
Cache.GetEnumerator();
while (enumerator.MoveNext())
keys.Add(enumerator.Key.ToString());
for (int i =
0; i < keys.Count; i++)
Cache.Remove(keys[i]);
}


Ankush ChauhanPosted Jul 15, 2020, 3:29 AM EDT
Can you confirm that above code is clearing all cache from site means of all pages cache?
Piyush MunjalPosted Dec 20, 2017, 3:47 AM EST
Where to call this method?
Surender GusainPosted Oct 31, 2014, 5:31 AM EDT
thanks, it works for me