1. Set fields
HSET sets one or more field→value pairs on the hash stored at the key, creating it if needed.
HSET user:1 name "Ada" age 36Typorithm · easy
Step 1 of 8 · intro card
Data Types
A Redis hash maps fields to values under a single key, making it ideal for representing objects like a user record compactly and efficiently.
A hash is a map of field→value pairs stored under one Redis key — a natural fit for objects such as a user, where each field (name, age) holds a value.
HSET writes one or more fields, HGET reads a single field, and HGETALL returns every field and value at once. HINCRBY atomically adds to a numeric field, so age can be bumped without a read-modify-write.
HDEL removes individual fields while leaving the rest of the hash intact. For small objects, hashes are memory-efficient and keep related data grouped under one key.
A hash maps field→value under one key.
HSET sets fields; HGET reads one.
HINCRBY atomically bumps a numeric field.
HSET user:1 name "Ada" age 36
HGET user:1 name
HGETALL user:1
HINCRBY user:1 age 1
HDEL user:1 ageConnect each part of the code to the concept before you type.
HSET sets one or more field→value pairs on the hash stored at the key, creating it if needed.
HSET user:1 name "Ada" age 36HGET returns the value of a single field within the hash.
HGET user:1 nameHGETALL returns every field and value in the hash as a flat list.
HGETALL user:1HINCRBY atomically adds an integer to a numeric field, here bumping age by 1.
HINCRBY user:1 age 1HDEL removes one or more fields from the hash without touching the rest.
HDEL user:1 ageRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.