【发布时间】:2013-01-19 19:46:24
【问题描述】:
我能否确定 IIS 重置或应用程序池回收会清除本地 asp.net 数据缓存?
本质上与此类似(即最终结果):
public void ClearApplicationCache()
{
List<string> keys = new List<string>();
// retrieve application Cache enumerator
IDictionaryEnumerator enumerator = Cache.GetEnumerator();
// copy all keys that currently exist in Cache
while (enumerator.MoveNext())
{
keys.Add(enumerator.Key.ToString());
}
// delete every key from cache
for (int i = 0; i < keys.Count; i++)
{
Cache.Remove(keys[i]);
}
}
【问题讨论】:
标签: asp.net asp.net-mvc-3 caching asp.net-mvc-4