Yesterday I read a post over at the EngineYard blog about a use case for Redis (in the name of being a polyglot, trying new things, etc.), and I just had to scratch my head. I love Redis — it rocks my world — but that example was too much for me. If you just want to store a set of ids somewhere to avoid normalization headaches, introducing Redis is overkill… just do it in MySQL!
He goes on and proposes a MySQL solution in which friends IDs are serialized as a comma separated list. Frankly speaking, I do see quite a few advantages Redis has compared to this one:
- Redis knows how to handle sets
- you don’t have to deal with de-duplication
- (most probably) the storage is optimized
- with manual serialization you’ll have to deal with all concurrency issues occurring when updating these lists
So what is the advantage of Ben’s suggested solution?