I'd like to know if there is any distributed cache systems like memcached, velocity or sharedcache that allows me to tag content with more than just it's name, or that can relate items to eachother, so if i invalidate the cache for one item it also invalidates the related items too.
eg. if i have two pages that reference the same data and that data changes, i'd like the cache for the two referencing pages to invalidate.
- or is this an addition to one of those projects begging to be developed? 🙂
edit: i'm on asp.net
Best Answer
I believe that deletion of dependent data can be done using memcached's cas (check-and-set) operation. Each value has a unique ID (serial). For each key, store another key.dependents, which has the serial of the data, and the keys of all dependents.
When going to add a dependent, do
When invalidating an item, do
Even in the presence of conflicting writes, these algorithms will eventually terminate, since one writer will always "get through".