zoukankan      html  css  js  c++  java
  • 如何从Asp.net应用程序中移除所有Cache对象

       Cache是Asp.net中非常强大的功能,我们使用它来提高应用程序的性能。有时我们需要在某个任务结束后移除所有Cache对象,如何做呢?有以下两段代码可以使用:

       1:              IDictionaryEnumerator cacheEnumerator = HttpContext.Current.Cache.GetEnumerator();
       2:   
       3:              while (cacheEnumerator.MoveNext())
       4:              {
       5:                  HttpContext.Current.Cache.Remove(cacheEnumerator.Key.ToString());
       6:              }

    OR:

       1:              foreach (DictionaryEntry dEntry in HttpContext.Current.Cache)
       2:              {
       3:                  HttpContext.Current.Cache.Remove(dEntry.Key.ToString());
       4:              }

    很简单,希望这篇POST对您有帮助。

    Author:  Petter Liu  http://wintersun.cnblogs.com

  • 相关阅读:
    POJ 3616 Milking Time(简单区间DP)
    AizuOJ ALDS1_7_A Rooted Trees(有根树的表达)
    jQuery中 attr() 和 prop() 的区别
    前后端交互模式
    快速排序
    冒泡排序实现
    Vue 组件间进行通信
    JavaScript 数组常用方法
    如何将内网映射到公网?
    javax.mail.AuthenticationFailedException: 535 Login Fail. Please enter your authorization code to login. More information in
  • 原文地址:https://www.cnblogs.com/wintersun/p/1671920.html
Copyright © 2011-2022 走看看