24.4. Caching with Dependencies

As time passes, the information in your data source may change. If your code uses caching, you may remain unaware of the changes and continue using out-of-date information from the cache. To help mitigate this problem, ASP.NET supports cache dependencies. Cache dependencies allow you to make a cached item dependent on another resource, so that when that resource changes, the cached item is removed automatically.

ASP.NET includes three types of dependencies:

  • Dependencies on other cached items

  • Dependencies on files or folders

  • Dependencies on a database query

You'll see all these types of dependencies in the following section.

24.4.1. File Dependencies

To use a cache dependency, you need to create a CacheDependency ...

Get Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional, Second Edition now with O’Reilly online learning.

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