views:

260

answers:

2

I have a web service with some data that I need to pass across sessions. I was thinking of using the application object.

1) Is this a good idea?

2) Some of the data will grow old and I'd like to purge it out so that the application object doesn't constantly grow. What is the best way to do this?

Thanks

+1  A: 

If your appdomain recycles, this data will be lost - will that be a problem? If so, you should probably consider persisting this data somewhere else, probably a DB...

You could then cache this data and retrieve from the DB if the cache data is missing.

Paddy
Lost data is not a problem. It's simply a cache that is regenerated when lost with little consequence.
Jeff
Actually, I think that if he uses Cache or any application variable the data will not be lost between calls....
Lucas
Quite, I didn't specify that, sorry, my thinking was that if he would have specific data to share between a few calls to a service, then he could run the risk of losing it. If it can be easily regenerated, then just a simple cache makes sense.
Paddy
+1  A: 

It depends on the data size... but Cache sounds good to me. If you realy need a good performance you could also implement distributed cache like memcached o NCache.

Lucas