Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

share|improve this answer
What if the data is tagged with two independent tags and you want to invalidate only the data, associated to the one of them? –  FractalizeR Oct 24 at 7:39

One alternative is Scache. It supports hierarchical filesystem like keyspace.

Mutually dependent data can be stored under common parent key and expired by clearing that parent key. Multiple clears can also be packed on single network request if there is multiple tags to be cleared.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.