Cache vs Application State -- Pls help understand

Discussion in 'ASP .Net' started by Guest, Jul 10, 2005.

  1. Guest

    Guest Guest

    Well I am quite confused with the methods out there. I would like to
    understand if Cache is the best method to store freq acessed data over
    application state.Currently I have pbs with the application state that it
    expires and results in error.

    Guest, Jul 10, 2005
    1. Advertisements

  2. Guest

    Guest Guest

    The general difference is that when you add an object into the Cache you can
    specify options controlling how long it will stay in there. You can specify
    an absolute timeout, or a sliding window.

    The general algorithm you should be using (in either case) is:

    if (item exists in cache)
    use item from cache
    re-calculate item
    store item in cache
    Guest, Jul 10, 2005
    1. Advertisements

  3. Guest

    Guest Guest

    Hi Vishwanathan, I believe your problems may result from 'going to
    sleep' after a period of inactivity (or aspnet recyling its worker process).
    The same problem would also occur if you were to use the cache object.

    Assuming IIS6 on W2k3, you can get around this by unchecking the option
    "shut down worker process after being idle for (time in minutes)" which is
    defaulted to 20 mins. (IIS-->Application Pools-->(pool for your

    A better solution would be to check whether the object exists in cache(or
    application) if it doesn't recreate it and put it back into cache(or app)
    then use it.

    HTH jd
    Guest, Jul 10, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.