What are the Types of Caching in asp.net ? Explain with examples.

Saturday, July 18, 2009


There are 3 types of caching in asp.net , they are:
1. Output Caching
2. Fragment Caching
3. Data Caching

1. Output Caching:
This type of caching caches the dynamic output generated.

Ex:
<%@ outputcache duration="75" VaryByParam="none" %>

2. Fragment Caching
This type of caching caches the portion of the page generated.

Ex:
Here caching is done based on the user control CtrlCountries,

<%@ outputcache duration="90" VaryByControl="CtrlCountries" %>

3. Data Caching
This type of caching caches the data object programatically.
Ex:
In the below example dsEmp is a dataset.
Cache.Insert("EmployeeDetails", dsEmp, Nothing,DateTime.Now.AddMinutes(.5), TimeSpan.Zero)





www.codecollege.NET

0 comments

Post a Comment

LinkWithin

Blog Widget by LinkWithin

Recommended Books