To Cache or Not to Cache...That is the Question

During the design phase of developing an ASP.NET application it is vital developers utilize the ASP.NET Cache feature.  A good “rule of thumb” when deciding when to use the caching feature is when data, pages, parts of pages are used more than once.  More specifically any data that is general in nature and does not change depending on specific user requests is a perfect scenario for caching.  This saves on time and overhead for collecting and creating reusable objects.  However, it is possible to use too much caching.  For example, on a 32-bit application process you do not want to use more than 800MB of private bytes.  This is an important consideration when designing your application to avoid those pesky “out of memory” errors.  Use but do not overuse. [more]

There are three types of cache in the ASP.NET framework to consider:

  • Output Caching: This caches the output of an entire page and can be called for future requests without re-executing

  • Fragment Caching: This is for caching parts of a page to be reused even as other requests are generating dynamically

  • Data Caching: Caches for objects to be re-used instead of re-creating.


  • With a little time spent on planning during design meetings can save you a lot of “head scratching” down the road.  The ASP.NET Cache API makes implementing caching easy for programmers and the benefits gained in terms of performance will save on support costs in the future.


    WildMetrix - A POWERFUL SIXTH SENSE
    __________________
    www.wilmetrix.com
    blog.ascendview.com
    0
    WildMetrix
    4/4/2009 6:26:21 PM
    asp.net.tips-tricks 851 articles. 0 followers. Follow

    0 Replies
    1014 Views

    Similar Articles

    [PageSpeed] 57

    Reply:

    Similar Artilces:

    Caching, Caching,Caching,Caching,Caching Why nobody know???
    I have posted this problem quite a few times but never got a decent answer and I have still not found a solution. Every time I have a gridview when the page is refreshed the data in the gridview does not refresh. You might say well and GridView.DataBind() to the pageload method but I think there is a performance problem if you bind your gridviews every time. For example I have a dropdownlist, a gridview and button and the gridview is supposed to refresh depending on the value in the dropdown when the button is pushed. if you click on the button the gridview data does not change unless y...

    To cache or not to cache ?
    I am really confused here. What I have are two forms one is where I get metadata for a document and next page where the user uploads the file for that document. What I want is a link from upload page back to the metadata page with the fields still filled in (cached maybe ?) and a link that takes back to that page without cache...In other words..I want two links on upload page one that take users back to the metadata page with fields filled in from previous request and the other link which takes to metadata form with empty fields. I am not sure how to accomplish this. I tried using ca...

    To cache or not to cache
    It's a well known fact that it's a good practice to cache results of SQL queries. But here as everywhere we should limit ourselfs and not to cache everything, shouldn't we? ) For example, you know that in facebook you can enter information about yourself - first name, last name, all your schools, jobs and so on. This data changes very rarely. So, as books say this data is perfect to be cached. But, you see, there can be millions of users with there profiles in our cache. So.. to cache or not to cache? )  it is a good practice to use limited size content and low edit freque...

    To Cache or Not To Cache?
    Hello, I'd like the opinion of the community on this question. We've just completed a migration from Exchange 5.5 to GroupWise 7. Migration went well. Right now, everyone is using WebAccess but I am rolling out the GroupWise Windows client (with latest FTFs) along with an updated XP SP2 workstation image shortly, to the office people. They had been using Outlook with Exchange, no caching. We have 6 locations with office people. About 25 are local to the PO server. The other locations, ranging from 25 to 8 per location are connected to the PO server via a T-1 WAN lin...

    to cache or not to cache?
    i have a toolbar at the top of all my web pages and I am not sure whether it is worth caching or not. this toolbar is in fact a search facility consisting of 4 dropdownlists. 3 of the DDL's are static and 1 is databound. i would like to make the whole toolbar into a user control and cache it. Q1. If one of the DDL's selected item has changed the user control must know not to load from the cache. is it possible to include this kind of logic to a cached user control? Q2. Is it worth caching my toolbar? Or should I just consider caching the 1 databound DDl instead? any help much apprec...

    newbie's question,HttpResponse.Cache is server side cache or client side cache?
    I mean if i want to cache some client-relate information,can i use the httpresponse.cache? The Cache object is server-side. Client caching is entirely controlled by the user's browser. So, you can only make suggestions to the client-side cache by using things like the Pragma-NoCache header....

    Questions about script caching and expiry of the cache
    Hi,I saw that AJAX scripts are cached by default (with possibility to disable it in web.config), I'm wondering what about in the following scenario :1. I use ASP.NET AJAX 1.0 RC in my application, users use it, so their IE caches the AJAX script of this release.2. When ASP.NET AJAX 1.0 RTM is released, and after I upgrade my application, what about the expiry of the cache of my users' IE :     - Will the HTTP request to ScriptResource.axd use different token (I mean the caracters after ScriptResource.axd?d=), so the cached resources will no more be used and the new will be req...

    .Net Caching Ughhhh (Micro-caching)
    I'm designing an application where data is continuous and becomes dirty in a matter of seconds. The load is also high and therefore, to avoid straining the database server, i cache all data for a couple of seconds. That's fine. However, some data are HIGHLY VOLATILE and requires the most latest data...for these types of data, I use 1 second caching. I done benchmarks of 1-6 second caching and the benefits on a high load server is enormous. However there is a problem with this micro caching technique.....the problem is...some of the objects get destroyed as soon as it is pulled out. ...

    Cache Options and purging cache question
    Has anyone changed anything from the default Cache Options? If so, why? Also, is there a way to clear the cache of a specific proxy service (ie: https://nam.com/Application2) as there was in iChain? I only see one way to purge the cache but it will purge all cache. -- rsmccain ------------------------------------------------------------------------ rsmccain, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been resolved? If not, you might try one of the...

    page cached that should not be cached
    Hi, Thanks for the support. I'm using ASP.NET 2 but my problem is that I have an asp.net web page called: extractimage.aspx that receive a query string parameter and returns an image, so I call it by: ~/inicio/extractimage.aspx?usu=25 I have a linkbutton in a grid with this link, so I refresh the Grid and the correct image should be shown. But when I change the image in other page and I try to refresh the Grid, the previous image is shown, not the new one. It seems the extractimage.aspx web page is cached and I do not want that, I would like the current image is always displayed, no...

    Cache
    Hello,could anyone point me to any resource/link/best practice explaining the use of the Sql Server cache used along with the Output cache?Thanks.VB .Net Coder - Apologize my C# nescienceBest Regards. http://beta.asp.net/QUICKSTART/aspnet/doc/caching/SQLInvalidation.aspx-BrockDevelopMentorhttp://staff.develop.com/ballen Hi Brock, If I use Output and SqlServer Cache, what happens? I mean, let's say I set a duration of 60 seconds for the Output Cache, and also I set the Sql Server Cache for a specific table in the same page. If nothing happens to the data of the aforementioned table,...

    how to clear out data cache, statement cache and procedure cache?
    Hi there, does anyone know is there some commands to to clear out data cache, statement cache and procedure cache? (without recycle database server) And for both ASE 12.5 and ASE 15? we need to run some performance comparsion in ASE 12.5 and ASE 15. I'd make sure the data cache are similar and procedure/statement cache is clear (so cached query plan is not used) for each case. This all depends on the (very) specific version of ASE data cache: ------------ as of 15.0.3 - dbcc cachedataremove(dbid | dbname, objid | objname, partitionid | partitionname, indid | indexname)...

    How does mozilla decide how image being cached in memory cache vs disk cache
    Hi, Can you please tell me how does mozilla decide image being cached in memory cache or disk cache? E.g. 1. I clear the cache in firefox 2. I load google.com. All images are cached in disk cache. 3. I load yahoo.com. There are 4 images cached in memory cache and the rest are cached in disk cache. What is the rule that mozilla is using to decide how to cache an image? Thank you. On 5/15/10 3:40 AM, Richard wrote: > 3. I load yahoo.com. There are 4 images cached in memory cache and the > rest are cached in disk cache. > > What is the rule that mozilla is using t...

    Cache/ DS question VB.Net 2.0
    I have started using caching of datasets to reduce database calls IE Return (CType(HttpRuntime.Cache("myds"), 123DS.123tableDataTable))  Now I need to select one record out of that dataset.  I cannot see how to do this without filling the dataset directly from the database?pgerrish phil's blog A DataSet is a collection of DataTables. So first you get access to a DataTable and then you can use the DataTable's Select method to get at the rows. Something like this: DataRow[] Rows = ds.Tables[0].Select("ID = 3");Steve Wellens My blog   Thank ...

    Web resources about - To Cache or Not to Cache...That is the Question - asp.net.tips-tricks

    West Lothian question - Wikipedia, the free encyclopedia
    He illustrated his point by pointing out the absurdity of a Member of Parliament for West Lothian being able to vote on matters affecting the ...

    The Islamic State inspires Eric Posner to question American values
    Slate got a lot of hateclicks yesterday for publishing Eric Posner’s argument that, in light of the Islamic State’s efforts to radicalize American ...

    Submit your questions for Autoblog Podcast #459
    Filed under: Podcasts On Episode #459 of the Autoblog Podcast, we'll discuss Cadillac's Escalade problem, GMC's need for a CUV, diesel and hybrid ...

    Excellent Question from an Awful Candidate
    Cholly Pierce notes that tribble-topped presidential aspirant Rand Paul actually asked an important question during last night’s GOP debate shit-show: ...

    Quick Question
    (Don Boudreaux) Tweet If advocates of stricter gun-control regulations are correct that easy access to hand guns necessarily leads to more ...

    Chris Matthews Really Doesn’t Like Questions About His Leg
    Politics can be so exhausting. Sometimes you just need to have a little fun. And all of us, no matter where we fall on the sociopolitical spectrum, ...

    The question remains: Would Bush support a 'Trump for president' ticket?
    Donald Trump vowed to forego a third-party run and stick with the GOP during last night’s debate, but we still don't know whether the other candidates ...

    Tom Brady Leaves Press Conference After Two Questions About His Friendship With Donald Trump
    This morning’s cover of the New York Daily New s features the headline “BRADY HAS NO BALLS” over a picture of New England Patriots quarterback ...

    'Star Wars: The Force Awakens' Cast Fields Your Fan Questions
    ET got the cast to answer a few of your fan questions at the premiere.

    For Designers, Learning To Code Isn't A Yes-No Question
    The former CEO of Berg explains why programming is just one way that designers ought to make sense of problems. From 2005 to 2014 (or 483 weeks ...

    Resources last updated: 12/17/2015 8:25:10 PM