Asp.net清除数据缓存及页面缓存

    //清除所有数据缓存
    IDictionaryEnumerator CacheEnum = Cache.GetEnumerator();
    while (CacheEnum.MoveNext())
    {
      Cache.Remove(CacheEnum.Entry.Key.ToString());
    }
   //清除指定的数据缓存

HttpRuntime.Cache.Remove(cacheEnmu.Key.ToString());
   

   //清除指定的页面缓存(注:在同一浏览器下要刷新一下)

   string PagePath = "/Default.aspx";
   HttpResponse.RemoveOutputCacheItem(PagePath);

posted on 2011-10-17 21:14  小小池  阅读(415)  评论(0编辑  收藏  举报