Wednesday, April 28, 2010

Caching in ASP.NET

If you want to improve performance of your ASP.NET application, then caching is the obvious choice.

Retrieving data/resources outside application takes more processing steps, more time and consumption of many resources in the server. ie, request will have to go to the server and server may have to contact a sql server for details.

consider if the data/resource readily available in the browser. This saves time, and eliminates many processing steps and result is high performance.

this technique of temporarily storing page output/ application data in client/server is called as caching

Caching can be implemented in 3 different ways:

  1. output caching
  2. fragment caching
  3. data caching

output caching - entire asp.net page can be cached. So that page don't have to re-create everytime and this results in fast loading of web page

fragment caching - part of asp.net page is cached and this part is loaded fast. @ OutputCache directive can be used for caching

data caching - caching application data improves the performance. Cache object allows to add any object to the cache. It is stored as key value pair.

Reference:

http://authors.aspalliance.com/aspxtreme/webapps/aspcachingfeatures.aspx

No comments: