caching when you store most frequently used data on to

Upload: justin-cook

Post on 30-May-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    1/7

    Caching

    When you store most frequently used

    data on to the temporary storage andproviding to different clients request,

    then it is called as caching.

    The main advantage of caching is to

    improve the performance of the webserver by reducing the processing time.

    When you are expecting more no. of

    requests .

    ASP 3.0 supports, entire page cachingonly at client side.

    ASP.Net supports 3 types of caching,

    a. Output Caching (Entire page

    Caching)

    b. Fragment Caching (Portion of web

    Page as Caching)

    c. Data Caching (memory Variable

    Caching)

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    2/7

    Output caching is also termed as

    entire page caching.When you want to maintain multiple

    buffers content towards a single web

    page then we require varybyparam

    option.

    To achieve this output caching go tohtml view,

    User defined controlWeb user control will provide

    reusability of graphical interfaces and

    coding.

    It will compile dynamically along with

    web page.

    The extension of the file is .ascx

    This is local to the application, so it

    will not appear in the toolbox.

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    3/7

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    4/7

    Data cachingWhen you apply caching

    on the memory variables, then it is

    called as data caching. This can beclassified into three types.

    1. Ordinary caching

    2. File based dependency data caching

    3. Time based dependency data

    caching

    In asp.net the alternative for

    application memory is provided with

    data caching.

    This will overcome all the drawbacksof application memory variable like,

    1. Data caching is a thread safe as

    compared to application memory.

    So the lock method will be applied

    implicitly to the variable, which is used

    for modification.

    Application. Lock ()

    Application. Unlock ()

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    5/7

    (Not required in case of caching)

    2. Data caching supports expiry policyfor the data, which is not supported by

    application memory variable.

    System.web.caching (namespace)

    Cache class

    CacheDependency Class

    Ordinary data caching

    Cache. Insert (A, 100)Or

    Cache (A) = 100

    File based dependency data caching

    When you want to provide expiry

    policy of data, based on time stamp of

    the file, then it is called as file based

    dependency data caching.

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    6/7

    Time based dependency data caching

    When you want to provide expirypolicy of data, based on time, then it is

    called as time based dependency data

    caching.

    Time can be based on two types.

    1. Absolute time will be consideredfrom storage time.

    Ex:

    Cache.Insert(A,100,Nothing,DateTime

    .Now.addminutes(5),Cache.noslidingExp

    iration)

    2. Sliding time will be considered

    from the last access.

    Ex:

    Cache.Insert(A,100,Nothing,

    Cache.noAbsoluteExpiration.Timespan.F

    romMinutes(5))

  • 8/14/2019 Caching When You Store Most Frequently Used Data on To

    7/7

    When it comes to data caching, the

    content will be erased, whenapplication demands for the memory.