Using the Cache APIs

Up to this point, you have only seen how to enable output caching. There is another side to caching, named data caching. This enables you to cache objects such as a DataSet or an ArrayList and share these objects application wide. For instance, say you have a DataSet that is created and used in more than one place in your application, yet it is always the same data. You can use data caching to place that DataSet into the cache the first time it is created and then access the DataSet from the cache when and where it's needed within your application. You can take it a step further by using page output caching on top of that.

In this section, I will give you samples of how to put data into the cache and how to access it. I'll ...

Get Programming Data-Driven Web Applications with ASP.NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.