乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      ASP.Net Cache(緩存)—ASP.NET細枝末節(jié)(2)

       昵稱10504424 2015-03-20

      概述

      1.意義

      把數(shù)據(jù)放到Cache中,在指定的時間內(nèi),可以直接從Cache中獲取,避免對數(shù)據(jù)庫等的壓力。

      2.做法

      設置:

      HttpRuntime.Cache.Insert(CacheKey, objObject,null,absoluteExpiration,slidingExpiration);

      讀?。?/FONT>

      HttpRuntime.Cache[“name”]

      Demo

      protected void Page_Load(object sender, EventArgs e)
      {
      //Cache是全局共享的
      DataTable dt = (DataTable)HttpRuntime.Cache["persons"];
      //如果Cache中沒有,再去數(shù)據(jù)庫中查詢
      //這樣可以降低數(shù)據(jù)庫服務器的壓力
      if (dt == null)
      {
      dt = SqlHelper.ExecuteQuery("select * from T_Persons");
      //存儲緩存,30秒后過期
      HttpRuntime.Cache.Insert("persons", dt, null,
      DateTime.Now.AddSeconds(30), TimeSpan.Zero);
      }
      Repeater1.DataSource = dt;
      Repeater1.DataBind();
      }

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多