Redis › Hashes in Redis

What is a Redis hash, and how do you create one to store a simple object with multiple fields?

Beginner

Answer

A Redis hash lets you store several field value pairs under a single key, similar to a small dictionary or object, using the HSET command to set one or more fields at once, which is a natural way to represent something like a user profile with multiple attributes.
HSET user:100 name 'Sarah' email 'sarah@example.com' age 29
Real-world example A user management system stores a user's name, email, and age together under a single hash key, keeping all of that related profile information organized in one place rather than as separate top level keys.

Common follow-ups: Can you set multiple fields in a single HSET command?;What happens if you call HSET on a field that already exists?