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);
}
}
/// <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);
}
}
相关文章推荐
- 继承System.Web.UI.Page的页面基类 生命周期
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- django 自带页面缓存cache_page的使用及清除
- 清除System.Web.HttpRuntime.Cache缓存
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类 示例(转截)
- 继承System.Web.UI.Page的页面基类
- 继承System.Web.UI.Page的页面基类
- Asp.Net 继承System.Web.UI.Page实现权限检测
- 此网页不允许使用基本类型“System.Web.UI.MasterPage”该类型未注册为安全类型
- 非静态的字段、方法或属性“System.Web.UI.Page.Session.get”要求对象引用
- 非静态的字段、方法或属性“System.Web.UI.Page.ClientScript.get”要求对象引用
- 浏览器系列:清除Web页面清缓存
- 错误处理:此网页不允许使用基本类型"System.Web.UI.MasterPage”该类型未注册为安全类型