Sorry for not being clear. What I meant was that when using a CacheDependency object to insert some object into an ASP.NET Cache, you can only depend on files. I don't see any way to depend on other cached objects or SQL code or anything else.
The Cache 2.0 API showing how to add items to the cache:
Code:
public object Add(string key, object value, CacheDependency dependencies,
DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority,
CacheItemRemovedCallback onRemoveCallback);
public void Insert(string key, object value);
public void Insert(string key, object value, CacheDependency dependencies);
public void Insert(string key, object value, CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration);
public void Insert(string key, object value, CacheDependency dependencies, DateTime absoluteExpiration,
TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback);
The CacheDependency 2.0 constructors:
Code:
public CacheDependency(string filename);
public CacheDependency(string[] filenames);
public CacheDependency(string filename, DateTime start);
public CacheDependency(string[] filenames, DateTime start);
public CacheDependency(string[] filenames, string[] cachekeys);
public CacheDependency(string[] filenames, string[] cachekeys, DateTime start);
public CacheDependency(string[] filenames, string[] cachekeys, CacheDependency dependency);
public CacheDependency(string[] filenames, string[] cachekeys, CacheDependency dependency, DateTime start);
So the only way to get a dependency is to use the CacheDependency object, and the only way to use a CacheDependency is to specify a file name.