Sign up ×
Server Fault is a question and answer site for 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?


locked by HopelessN00b Jan 23 at 12:12

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as off-topic by HopelessN00b Jan 23 at 12:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the 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.

What if the data is tagged with two independent tags and you want to invalidate only the data, associated to the one of them? – Vladislav Rastrusny Oct 24 '14 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.


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