/// <summary>
/// 清空所有的Cache
/// </summary>
public static void ClearCache()
{
List<string> cacheKeys = new List<string>();
IDictionaryEnumerator cacheEnum = HttpContext.Current.Cache.GetEnumerator();
while (cacheEnum.MoveNext())
{
cacheKeys.Add(cacheEnum.Key.ToString());
}
foreach (string cacheKey in cacheKeys)
{
HttpContext.Current.Cache.Remove(cacheKey);
}
}
如果您觉得本文的内容对您的学习有所帮助:
关键字:
.net C# 缓存 Cache