Cache vs Application State -- Pls help understand

G

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.

Vishwanathan
 
G

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
}
else
{
re-calculate item
store item in cache
}
 
G

Guest

Hi Vishwanathan, I believe your problems may result from asp.net '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
app)-->Properties-->Performance)

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
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top