Brett,
I will assume your link changes due to a change in the data on the
backend.
Whenever you add an item to the cache you can attach the
CacheDependency. This could be a dependency on a database table, a
file or another kind of dependency. I am not sure what you mean by it
requiring a full path. When you add an item to the Cache you use a
unique identifier for the item with the item being any kind of object.
In this case a string will obviously work.
I have often added items to the cache without a dependency because I
just want to hold onto it for a the length of the timeout or until the
cache removes it to clear space for newly added items. Using the cache
without a dependency in this way is sufficient to reduce load on the
database, especially when I know the data is not changing. But if the
data does change you can monitor it with a dependency and attach that
dependency to the cached item.
Be sure to use Cache.Insert(...) instead of Cache.Add(...) and set up
your dependency to do as you want. The Insert replaces an existing
item with the same key. The trick is using a unique key which you can
know before pulling the data used to assemble the cached item. I use a
prefix to give it some context and then usually append the primary key
or query parameters to that prefix to create the key.
See SQL Cache Dependencies here...
http://msdn2.microsoft.com/en-us/library/system.web.caching.sqlcachedependency(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldependency(VS.80).aspx
I hope this is what you wanted to know. If not, let me know.
Brennan Stehling
http://brennan.offwhite.net/blog/