Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ASP.NET Cache»º´æÏê½â

Àý×Ó£º
using system.web.caching
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="C#" runat="server">
void Page_Load(Object Src, EventArgs E) {
DataView Source;
// Retrieve the DataView object from Cache. If not exist, then add DataView object to the Cache.
Source = (DataView)Cache["MyDataSet"];
if (Source == null) {
SqlConnection myConnection = new SqlConnection("Server=ServerName; database=Pubs; user id=UID; password=PWD;");
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Authors", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "Authors");
Source = new DataView(ds.Tables["Authors"]);
Cache["MyDataSet"] = Source;
CacheMsg.Text = "Dataset created explicitly";
}
else {
CacheMsg.Text = "Dataset retrieved from cache";
}
// Binding the DataView object with DataGrid.
MyDataGrid.DataSource=Source;
MyDataGrid.DataBind();
}
</script>
<body>
<form method="GET" runat="server">
<h3><font face="Verdana">Caching Data</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaad" />
<p>
<i><asp:label id="CacheMsg" runat="server"/></i>
</form>
</body>
</html>
ASP.NET CacheÊÇÌáÉýϵͳÐÔÄܵÄÖØÒª·½·¨£¬ËüʹÓÃÁË“×î½üʹÓÔԭÔò£¨a least-recently-used algorithm£©¡£ÔÚÊý¾Ý¿â·ÃÎÊÖо­³£»áÓõ½Cache±£´æÊý¾Ý¿âÊý¾Ý¡£ 1.»º´æµÄÌí¼Ó£ºCacheµÄÌí¼Ó·½·¨ÓÐAdd()»òInsert£¨£©£¬Á½ÖÖ·½·¨¼¸ºõÀàËÆ£¬Ö»ÊÇInser·½·¨¿ÉÒÔʹÓÿÉÑ¡²ÎÊý£¬¼´Ê¹ÓÃĬÈϲÎÊý£¬À´ÊµÏÖ»º´æµÄÌ


Ïà¹ØÎĵµ£º

ÎļþÉÏ´«´úÂ루asp.net£©

Boolean fileOK = false;
        String path = "D:\\";
        //string path = "1.gif";
      
            String fileExtension =
 &nbs ......

Asp.Net ¿Ø¼þ¿ª·¢Ö®×ÊÔ´Îļþ´¦Àí

ÔÚWEB¿ª·¢Öо­³£»áʹÓÃһЩJS£¬IMAGE£¬CSSµÈÏà¹ØÊý¾Ý¡£ÔÚWEB½â¾ö·½°¸Öо­³£×öΪһ¸öÎļþ¼Ð´¦Àí¡£ÔÚʹÓõÄÒ³ÃæÖÐÒýÓÃÏà¶Ô·¾¶¾Í¿ÉÒÔÁË¡£µ«Ôڿؼþ¿ª·¢ÖУ¬¾ÍÅöµ½Ò»¸öÎÊÌâ¡£Èç¹ûÎҵĿؼþÐèÒªÒ»¸öJSÎļþ»òÊÇCSSÎļþ»òÊÇÒ»¸öͼƬÔõô°ì£¿×ܲ»ÄÜÔڿؼþµÄDLLÎļþÍâÔÙ¼ÓÒ»¸ö·ÅÖÃÐèÒªÎļþµÄÎļþ¼Ð¡£Ã¿´ÎÓö¼ÐèÒª¿½±´¹ýÈ¥¡£Ì«Âé·³ÁË£¬ ......

ASP.NET C# Éú³É¾²Ì¬Ò³Ãæ¼òµ¥·½·¨

ASP.NET C# Éú³É¾²Ì¬Ò³Ãæ¼òµ¥·½·¨
 
//Ô´ÂëÊÇÌæ»»µôÄ£°åÖеÄÌØÕ÷×Ö·û
            string mbPath = Server.MapPath("template.html");
            Encoding cod ......

Asp.netÖÐcache¶ÔÏó¼ò½é

Asp.netÖ§³ÖÈýÖÖÀàÐ͵Äcache
Ïëдһ¸ö¼¼Êõ¿ìËÙ¸ÅÊö£¬¿ÉÄÜдµÃÌ«¶àÁË¡£¼¼Êõ¸ÅÂÔµÄÄ¿µÄÊÇÒÔ×î¿ì×î¼òµ¥µÄ·½Ê½ÃèÊö³ö¼¼ÊõÒªµã£¬Ò²ÊÇÎÒÏ£ÍûµÄ×îÓÐЧÂʵÄ֪ʶ´«²¥·½Ê½¡£
1£® Ò³Ãæ/¿Ø¼þcache
2£® Ó¦ÓóÌÐò¼¶cache
3£® ä¯ÀÀÆ÷¿Í»§¶Ëcache
´ÓʵÏÖ·½Ê½À´¿´£¬Ò³Ãæ/¿Ø¼þcacheºÍÓ¦ÓóÌÐò¼¶cache¶¼ÊÇ´æ·ÅÔÚ·þÎñÆ÷ÄÚ´æÀïÃæµÄ£¬Ëæ×ÅÄÚ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ