Caching in ASP.NET

Discussion in 'Web Programming' started by ravbop1, Sep 14, 2011.

Caching in ASP.NET
  1. Unread #1 - Sep 14, 2011 at 3:45 AM
  2. ravbop1
    Joined:
    Sep 13, 2011
    Posts:
    1
    Referrals:
    0
    Sythe Gold:
    0

    ravbop1 Newcomer

    Caching in ASP.NET

    ASP.NET has taken some dramatic steps forward with caching. Many developers who first
    learn about caching see it as a bit of a frill, but nothing could be further from the truth. Used
    intelligently, caching can provide a huge amount of performance improvement by retaining
    important data for just a short period of time.

    Caching is often used to store information that’s retrieved from a database. This makes
    sense—after all, retrieving information from a database takes time. With careful optimization,
    you can reduce the time and lessen the burden imposed on the database to a certain extent,
    but you can never eliminate it. But with a system that uses caching, some data requests won’t
    require a database connection and a query. Instead, they’ll retrieve the information directly
    from server memory, which is a much faster proposition.

    ASP.NET really has two types of caching. Your applications can and should use both types,
    because they complement each other:

    • Output caching: This is the simplest type of caching. It stores a copy of the final rendered
    HTML page that is sent to the client. The next client that submits a request for
    this page doesn’t actually run the page. Instead, the final HTML output is sent automatically.
    The time that would have been required to run the page and its code is completely reclaimed.

    • Data caching: This is carried out manually in your code. To use data caching, you store
    important pieces of information that are time-consuming to reconstruct (such as a
    DataSet retrieved from a database) in the cache. Other pages can check for the existence
    of this information and use it, thereby bypassing the steps ordinarily required to
    retrieve it. Data caching is conceptually the same as using application state, but it’s
    much more server-friendly because items will be removed from the cache automatically
    when it grows too large and performance could be affected. Items can also be set
    to expire automatically.

    Also, two specialized types of caching build on these models:

    • Fragment caching: This is a specialized type of output caching—instead of caching the
    HTML for the whole page, it allows you to cache the HTML for a portion of it. Fragment
    caching works by storing the rendered HTML output of a user control on a page. The
    next time the page is executed, the same page events fire (and so your page code will
    still run), but the code for the appropriate user control isn’t executed.

    • Data source caching: This is the caching that’s built into the data source controls,
    including the SqlDataSource, ObjectDataSource, and XmlDataSource. Technically, data
    source caching uses data caching. The difference is that you don’t need to handle the
    process explicitly. Instead, you simply configure the appropriate properties, and the
    data source control manages the caching storage and retrieval.

    more information at Cegonsoft
     
< Offering free help with HTML/PHP & SQL | Security in ASP.NET >

Users viewing this thread
1 guest


 
 
Adblock breaks this site