Caching is a way to improve the performance of your website. Caching is the technique of storing an in-memory copy of some information that’s expensive to create. You can store the list of query or a output html form.
The following are the techniques of caching
1. Output caching
2. Data caching
1. Output caching - This is the simplest type of caching. It stores a copy of the final HTML page that is sent to the client. When next client submits a request for same page doesn’t actually run the page. Instead, the final HTML output is sent automatically. The time that would have been required to run the page and its code is completely reclaimed.
If you want to use output caching just add the following line of code at top of your directive in your aspx page
Replace ><> after copy paste in your application
>%@ OutputCache Duration="20" VaryByParam="None" %<
the duration attribute tells the asp.net to cache this page for 20 seconds
2. Data Caching - It is done manually in your code. To use data caching, you store important pieces of information that are time-consuming (such as a DataSet retrieved from a database) in the cache. Other pages can check for the existence of this information and use it. Data caching
is conceptually the same as using application state, but it’s much more server-friendly because items will be removed from the cache automatically when it grows too large and performance could be affected. Items can also be set to expire automatically.
Wednesday, October 31, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment