aspdotnet_website_programming thread: ViewState vs Cache object for storing a dataset
I read an article where the author used a cache object for storing a
dataset which is then used to display data in a datagrid in order to avoid
database interactions for cases like sorting, paging etc.
I have some questions regarding this
1. How can I specify querystring variables in my cachedependency class so
that the dataset in the cache is cleared if the user specifies different
2. A cache object is like an application variable with much more features
like cache dependency, absolute expiration etc. But will it not take up
lots of server resources?
3.Is it possible that a cache object (having application scope) will
display same result to two simultaneous users (say in case of a search, if
2 users specify different criteria, will they get correct results and
accordingly their datasets will be stored in the cache?
4.Saving database interactions each time the user sorts/pages the datagrid
can be accomplished by storing the dataset in a ViewState object.
Does storing a dataset in viewstate is more overhead than storing it in a
cache or viceversa?
And finally if both of them work the same way then which one should we
storing dataset in a viewstate or storing it in a cache object?
Any answers to the above are highly appreciated.
Thanks in advance