Application or Cache

  • Thread starter Thread starter stefano mostarda
  • Start date Start date
S

stefano mostarda

Hi there,

I have a question.

In my application I have a table which is frequently used to fill a combo. I
want to store it in the application or cache object. it is never updated.

What's the besta container to improve performance and scalability, Cache or
Application object?

Thanks in advance
Stefano Mostarda
Rom Italy
 
Stefano,

You can store this in either really. If you use the Cache though you can
set a sliding scale expiration, for say an hour, so that its not using up
resources when not in use.

Janaka
 
The Cache is the best place to store whatever you need. It is thread-safe,
for one thing.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
Also application was provided for backward compatibility with asp classic
and shouldn't be used going forward

regards
 
Using the cache does require a little more work (but it is worth it).
Basically, in your code, you read the cache. If you don't find the item,
you have to build it and then load it into the cache. You cannot assume
that the item will always be in the cache. This is because ASP.NET will
start deleting items from the cache if it starts running out of memory.

Once you get used to coding this way, it is pretty easier. And the Cache
object is much more flexible than the Application object ever was.

Jeff
 
Back
Top