Using Caching Effectively

IOTA^_^    

Sams Teach Yourself ASP.NET in 21 Days, Second Edition
By Chris Payne
Table of Contents
Day 14.  Using ASP.NET's Improved Caching Capabilities


Caching can greatly enhance the performance of your ASP.NET applications. In high-volume situations, even caching items for as little as one minute can help tremendously. If you save one second for each item cached, imagine the benefits when you receive a hundred requests a minute.

Retrieving information from memory is incredibly faster than retrieving the same information from a database or hard drive. As long as you have memory on your server to spare, throw things into cache! With memory caching, your Web site will be able to spit out Web pages faster than ever before.

Generally, there's a lot of information that can be cached safely. This includes data retrieved from a database or a file, complex calculations, and application settings.

However, there are times when it isn't a good idea to use caching. Imagine an online broker that must deliver up-to-the-second stock quotes. Caching here would be a bad idea unless you had adequate dependencies set. Even then, it might not be worth it.

Do Don't
Do cache commonly accessed data that might not change often. Don't cache pages with time-based values. Users may not understand why their clocks are behind.
Do cache settings or objects that will be used for your entire application, but that won't vary throughout its lifetime. Don't cache objects that the user can modify at any time, such as a shopping cart, unless you build in ways to update the cache at appropriate intervals.


    IOTA^_^    
    Top


    Sams Teach Yourself ASP. NET in 21 Days
    Sams Teach Yourself ASP.NET in 21 Days (2nd Edition)
    ISBN: 0672324458
    EAN: 2147483647
    Year: 2003
    Pages: 307
    Authors: Chris Payne

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net