views:

182

answers:

4

If yo have multiple users on your website on the same page and they are running queries (searches) and the results are stored in a datatable. Will the last person's search overwrite the application Cache if you store it in the Cache? Is this a reason to use Session?

+2  A: 

If you stored them under the same key, sure. If you made the key user- or session- specific, you could avoid a clash.

Oli
+2  A: 

It depends on how you store the information to the cache. If the info is the result of different queries, then the cache should store that value in different keys.

Jeff Martin
+2  A: 

Please take the time to read the Cache documentation. This is the second question in a few minutes that could be easily answered if you bothered to read the documentation.

StingyJack
I don't believe "Why haven't you bothered to read the manual" sort of answers are with in the spirit of SO. By all means point out where exactly in the documentation useful info can be found. Not everyone is an avid reader esp. of MS documentation.
AnthonyWJones
+1  A: 

You should note that cache and session are different in more ways than simply scope of access.

Items in a cache are typically of the sort that can be recreated if need be and by default items can drop out of the cache arbitarily.

On the other hand items in the session will remain in the session until specifically removed by code. Also session may not be an in process local store, it may be on another process, server or even in a database.

AnthonyWJones