Data caching is another feature provided by ASP.NET that can significantly increase the speed of your data access code, by not retrieving the same data repetitively. In ASP.NET, the cache is implemented using the Cache object. Because it works just like any dictionary object, it's easy to use. The following line of code will store a DataSet in the Cache object with the name “Categories”:
Cache("Categories") = dsCategories
It can be read out of the cache later with the following code:
myDataSet = Ctype(Cache("Categories"), DataSet)
To implement data caching in your Web application, first check to see if the DataSet is stored in the cache. If it is, use the cached version. Otherwise, load the DataSet data from the database and ...