C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET WebForms »

Caching


Posted Date: 29 Nov 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: Arun JacobMember Level: Gold    
Rating: 1 out of 5Points: 10



Caching can be mainly classified as,

1.Page Output Caching
2.Object Caching

1.Page Output Caching

we can cache page output means we can cache rendered html so that no need to render html again.So it'll be taken from the cache.Its useful for pages with static content.For user controls we can use fragment caching.so in a page rendered html for user controls will be taken from the cache instead of whole page.


<%@ OutputCache VaryByParam="*" Duration="5" %>


2.Object caching

we can cache objects in the cache so that data will be taken from the cache instead of from database.we can set dependency for caching like file dependency,sql dependency.


if (Cache["Key"] != null)
return Cache["Key"] as object;
else
Cache["Key"] = GetFromDataBase();


or


if (Cache["Key"] != null)
return Cache["Key"] as object;
else
Cache.Insert("Key", GetFromDataBase());


:-)




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Caching  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: WebServices
Previous Resource: ASP.NET Validation Controls
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use