I did not know that you can do this, but if you look at the CacheDependency constructor here , you will see that the second parameter is an array of cache keys, so if any of these cached elements change, the whole dependency will be changed, and your dependent item will also be invalid.
So your code would be something like this:
String[] cacheKeys = new string[]{"cacheKey1","cacheKey2"}; var dep = New CacheDependency("", cacheKeys); HttpRuntime.Cache.Add(itemDescriptor, ret, dep ...);
source share