When the thing you're storing has more than one field, a plain string forces an awkward choice: serialize the whole object into JSON and rewrite it on every change, or spread the fields across many separate keys. Hashes are the structure that fits objects properly. They store field-value pairs under one key, let you read and update individual fields, and keep related data grouped, which is exactly what you want for a user record, a session, or a cached row.
This is part 4 of the Redis Masterclass, following
About the author
Aman Kumar Singh is a Team Lead & Senior Software Engineer based in Noida, India, writing about full-stack engineering, system design, and production SaaS with TypeScript, Next.js, NestJS, PostgreSQL, and Redis.
- Portfolio:
- LinkedIn: amansingh1597
SOCIAL SHARE CARD GENERATOR