您的位置:首页 > 产品设计 > UI/UE

System.Web.UI.Page.Cache 页面 缓存 清除

2017-06-19 11:47 381 查看
这个也是网上查询到方法,不错记录一下!

/// <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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: