This is a discussion on What are the Types of caching in dot net 2005? within the ASP and ASP.NET Programming forums, part of the Web Development category; What are the Types of caching in dot net 2005?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| ASP.NET supports three types of caching for Web-based applications: • Page Level Caching (called Output Caching) • Page Fragment Caching (often called Partial-Page Output Caching) • Programmatic or Data Caching Output Caching Page level, or output caching, caches the HTML output of dynamic requests to ASP.NET Web pages. The way ASP.NET implements this (roughly) is through an Output Cache engine. Each time an incoming ASP.NET page request comes in, this engine checks to see if the page being requested has a cached output entry. If it does, this cached HTML is sent as a response; otherwise, the page is dynamically rendered, it's output is stored in the Output Cache engine. Partial-Page Output CachingPartial-Page Output Caching, or page fragment caching, allows specific regions of pages to be cached. ASP.NET provides a way to take advantage of this powerful technique, requiring that the part(s) of the page you wish to have cached appear in a User Control. One way to specify that the contents of a User Control should be cached is to supply an OutputCache directive at the top of the User Control. That's it! The content inside the User Control will now be cached for the specified period, while the ASP.NET Web page that contains the User Control will continue to serve dynamic content. (Note that for this you should not place an OutputCache directive in the ASP.NET Web page that contains the User Control - just inside of the User Control.) Data Caching Sometimes, more control over what gets cached is desired. ASP.NET provides this power and flexibility by providing a cache engine. Programmatic or data caching takes advantage of the .NET Runtime cache engine to store any data or object between responses. That is, you can store objects into a cache, similar to the storing of objects in Application scope in classic ASP. (As with classic ASP, do not store open database connections in the cache!) Realize that this data cache is kept in memory and "lives" as long as the host application does. In other words, when the ASP.NET application using data caching is restarted, the cache is destroyed and recreated. Data Caching is almost as easy to use as Output Caching or Fragment caching: you simply interact with it as you would any simple dictionary object. |
| |||
| Output cache functionality is achieved by using “OutputCache” attribute on ASP.NET page header. Below is the syntax. <%@ OutputCache Duration="20" Location="Server" VaryByParam="state" VaryByCustom="minorversion" VaryByHeader="Accept-Language"%> VaryByParam :- Caches different version depending on input parameters send through HTTP POST/GET. VaryByHeader:- Caches different version depending on the contents of the page header. VaryByCustom:-Lets you customize the way the cache handles page variations by declaring the attribute and overriding the GetVaryByCustomString handler. VaryByControl:-Caches different versions of a user control based on the value of properties of ASP objects in the control.
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Hi buddy..., Caching is an important concept in computing. When applied to ASP.NET, it can greatly enhance the performance of your Web applications
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| Hi guys, I got an idea about cache in dotnet... Now i want to know about Cache Callback in Cache... Can anyone clear me....
__________________ Krishnakumar.S Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily |
| |||
| Cache object is dependent on its dependencies example like file based, time based etc...Cacheitems remove the object when cache dependencies change.i think ASP.NET provides capabilityto execute a callback method when that item is removed from cache.
__________________ cheers Aman |
| |||
| I need help for user specific Cache... We have a web application, where we use the session to store the user specific data,and also we have datagrids which has paging and using Dataset stored in session.since these dataset r holding large amount of data ie about 1000 recs min , and v have such datagrids throught the application ,according to the customer request. We r planning to replace the session object by Cache object. since all these data are user specific, and the Cache object is of Application scope,Can u suggest me the methods the keep these cache items user specific. I planned to concatnate the session id with the cache item name,so when accesed the cache item created by the user will be unique. Is there any other method to make cache items user specific. thnx... |
| |||
| Hi, Does your application need the user data to be cached even after the session is closed? If this is not a case, store data in Session rather than in Cache. You said that you will be appending the sessionid to the cache item name, which means that the data is not useful once the session is closed. So, storing data in cache unnecessary, as it is application scope increases load at the server. So, rethink about storing data in Cache object. Better store data in Session Object. You can access data from the database instead of storing it in Session also. But, the tradeoff is between at how many places does you need this data. If it is required at fewer places (<15) for a huge application, then better go for DB every time. But, you need to consider the amount of other data storing in session. Also, consider the number of users accessing your site simulatenously. Because, if you are storing data in session and number of people accessing the site is hight, then you can get memory problems.
__________________ Venkat knowledge is Power |
| |||
| Hi Venkat, thanks for your reply, i need little clarification on it. I will use the session. My doubt is where these values will be stored in server and is any difference between these in performance.... thangs again venkat.... thnx.... |
| |||
| Hi venkat, i got the difference between cache and session and here it is. Cache: The concept of Caching used in case of Performance Improvement.When web pages do not frequently change we use the concept of caching.All the object stores in the memory .There are two types of caching 1) output caching 2)Fragment Caching . it basically reduce the load of web site. Session: Session object is basically used for Specific User and maintains its state.The default Timeout is 20 minute but you can reset the time ,you can store any object in session and also remove it. Ex: Session["mysession"] = "This is my Session" thnx... |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/2712-what-types-caching-dot-net-2005-a.html | |||
| Posted By | For | Type | Date |
| What are the Types of caching in dot net 2005? | Web Hosting | This thread | Refback | 01-09-2008 11:47 PM |
| DiscussWeb IT Community - Fusing | This thread | Refback | 08-08-2007 07:32 AM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Explain how Caching in Asp.net 2.0 is different from Caching in Asp.net 1.1? | Arun | ASP and ASP.NET Programming | 6 | 09-19-2007 10:15 PM |
| Caching in php | abhilashdas | PHP Programming | 1 | 08-06-2007 11:42 PM |
| I Cannot access SQL 2005 integrated services after installing SQL-2005..? | theone | Database Support | 1 | 07-27-2007 01:12 AM |
| How many types of authentication modes are there and what are the Types.... | Archer | ASP and ASP.NET Programming | 1 | 07-25-2007 03:48 AM |
| ASP Caching | nhoj | ASP and ASP.NET Programming | 0 | 04-09-2007 09:12 AM |