O'Reilly logo

Sams Teach Yourself ADO.NET in 24 Hours by Paul Bertucci, Jason Lefebvre

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data Caching

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required