Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Data Caching in ASP.NET

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 244
    Comment on it

    DATA CACHING: It is a technique that allows for storing data/information in memory for rapid access. Caching is used in case if we need the same data/information next time, it could be directly retrieved from the memory instead of being generated by the application.

    Types of caching:

    1. Output caching
    2. Data caching
    3. Object caching
    4. Class caching
    5. Configuration caching

    OUTPUT CACHING: This helps in storing a copy of the finally rendered HTML pages or part of pages sent to the client. When the next client requests for the same page, a cached copy of the page is sent, instead of regenerating the page, which also helps in saving time.

    The OutputCache directive is responsible of output caching.

    Syntax for OutputCache directive:

    <%@ OutputCache Duration="25" VaryByParam="None" %>
    

    This tells the environment to cache the page for 25 seconds.

    DATA CACHING: This means caching data from a data source. If the cache is not expired, a request for the data will be fulfilled from the cache. But, if the cache is expired, fresh data is obtained by the data source and the cache is refilled.

    OBJECT CACHING: You can use object caching to place any object in the cache. The object can be of any type - a data type, a web control, a class, a dataset object, etc

    CLASS CACHING: * When run web pages or web services for the first time, they are compiled into a page class in the assembly. Then the assembly is cached in the server. Next time when a request is made for the page or service, the cached assembly is referred. When the source code is changed, the CLR recompiles the assembly.*

    CONFIGURATION CACHING: * Configuration caching stores the configuration information in the server memory.*

    Advantages of caching:

    1. It helps in reducing the load in the web services/database.
    2. It can take heavy load / execution from the server for repeated operations.
    3. Increases reliabilty.

    Disadvantages of caching:

    1. High Maintenance is required
    2. High scalabilty issue

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: