Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What are Hash Tags in Redis Cluster and why are they necessary for multi-key commands?
senior LevelredisAdvanced Internals
In Simple Words:
In Redis Cluster, multi-key commands (MGET, MSET, transactions) fail if the keys live on different cluster nodes:
- Hash Tags
{...}: Force Redis to hash only the text inside curly braces:user:{101}:profileanduser:{101}:orderswill hash strictly on{101}.
- Guarantees both keys map to the exact same hash slot and physical node, allowing atomic transactions and multi-key queries!