Any distributed caching systems for tagging content?

I would like to know if there are any distributed caching systems, such as memcached, speed, or a shared cache that allows me to tag content more than just its name, or that can associate elements with each other, so if I invalidate the cache for one item also invalidates the related items.

eg. if I have two pages that link to the same data and that the data is changing, I would like the cache for the two link pages to be invalid.

  • or is it an addition to one of those projects that are asked to be developed? :)

edit: I'm on asp.net

+5
source share
3 answers

Velocity supports tagging, where each tag is a string. Objects can be retrieved by a tag or several tags, for example. Seasoning and Free Shipping.

However, Velocity does not have dependency support - the IIRC team on the Velocity team stated that the dependencies will not be in v1.

0
source

I believe that deletion of dependent data can be done using memcached cas (check-and-set). Each value has a unique identifier (sequential). For each key, save another dependency key, which has a series of data and the keys of all dependents.

If you want to add a dependent, do

dependents, dep_serial = fetch(key+".dependents") data, serial = fetch(key) if serial != dependents[0]: # somebody changed the actual data start_over generate_and_cache_dependent(dep_key, data) dependents.append(dep_key) if not cas(dependents, dep_serial): # somebody changed dependents start_over # can avoid regenerating the data if they are still at serial 

If the item is invalid, do

 dependents, dep_serial = fetch(key + ".dependents") serial = update(key, new_data) for dkey in dependents[1:]: delete(dkey) dependents = [serial] if not cas(dependents, dep_serial): start_over 

Even if there are conflicting entries, these algorithms will eventually cease, since one writer will always β€œpass”.

+3
source

implementing dependencies is quite complicated, but perhaps all the other features of the shared cache ( http://www.sharedcache.com || http://sharedcache.codeplex.com ) will fit your caching needs.

roni

0
source

All Articles