p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

aspdotnet_website_programming thread: ViewState vs Cache object for storing a dataset

Message #1 by glads2win@y... on Tue, 4 Mar 2003 16:06:46
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 
search parameters.
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

  Return to Index