Friday, January 28, 2011

Taggable alternatives to memcache

I'm looking for a caching solution quite similar to memcache, but the one thing I sorely miss is invalidating content based on a tag. Many preprocessed results depend on multiple sources of data, and a source of data contributes to multiple results. Altering sources of data should cascade into invalidating or those caches.

Of course I could store a tag as a key, with a list of other keys it generated / are dependent on it, but as any speed gain is of the essence, I'd rather not make multiple trips. What are my alternatives for a non-permanent, expiring in-memory data storage that has that capability?

  • The solution is to start each key with a variable number which you can use to invalidate all the associated data.

    For example use xxx_datakey to store all data which needs to be invalidated together. yyy_datakey to store another group of data which needs to be invalidated together

    xxx is a number which you store in memcacace and need to read only once per transaction. and only store if it changes.

    if you want to invalidate all the group which starts with xxx just increment xxx value in memcache.

    From Niro

0 comments:

Post a Comment