Getting started with ASP. net2.0 Cache Technology

Source: Internet
Author: User

Getting started with ASP. net2.0 Cache Technology
Source: boke.com
 
 
ASP. net2.0 provides the following caching methods:

Output caching

Fragment caching

Data Cache

SQL Cache

Cache Configuration

1. output caching:

When a webpage is frequently accessed, We Can cache the entire webpage to improve efficiency. When the user accesses the webpage, the formatted HTML is directly sent to the client.

<% @ Outputcache duration = "120" varybyparam = "NONE" %>

2. Parameter cache:

Pages are generated based on user requests. There are only a limited number of combinations of user requests. The table caches content based on parameters.

<% @ Outputcache duration = "120" varybyparam = "state" %>

<% -- <A href = "default. aspx? State = Ca "> </a> -- %>

3. Hard disk cache:

By default, the output cache is cached on the hard disk. You can modify the diskcacheenable attribute to set whether the cache is cached. You can also configure the cache file size in Web config.

4. Page fragment cache:

The content on the page is dynamically updated based on the request, and most of the content can be cached. (If multiple controls need to be cached, they can be used as one user control)

<% @ Outputcache duration = "120" varybycontrol = "controlid" %>

<Center> </center>

5. cache data:

We recommend that you enable the hard disk cache for a longer cache time because of Io overhead.

Dataset DS = new dataset ();

DS = cache ["restaurant"];

If (DS = NULL)

{

DS = resdataset;

Cache ["restaurant"] = Ds;

}

6. SQL dependency

Configure the SQL cache of the database server and then reference it on the page

<Center> </center>

7. cache configuration (reduce repeated definitions)

A. Web. config Definition

<Center> </center>

B. Page call

<% @ Outputcache cacheprofile = "cachefor60seconds" varybyparam = "name" %>
<Table width = "90%" border = "0" cellpadding = "0" cellspacing = "0" align = "center">
<Tr> <TD> <B> popular recommendations </B>: </TD>
<TD> <a href = "http://www.enet.com.cn/article/2007/1210/A20071210942740.shtml" target = "_ blank"> <font size = 2 color = Red> invincible command to delete files that cannot be deleted
</Font> </a> </TD>
<TD> <a href = "http://www.enet.com.cn/article/2007/1211/A20071211943925.shtml" target = "_ blank"> <font size = 2 color = Red> 7 tips for Windows anti-Black attack </font>/ a> </TD>
</Tr> </table>
 
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.