Hashes in Redis

From the Redis cheat sheet · Data Structures · verified Jul 2026

Hashes

Field-value pairs (like objects)

bash
# Set fields
HSET user:1 name "John"
HSET user:1 age 30

# Get fields
HGET user:1 name
HGETALL user:1

# Multiple fields
HMSET user:2 name "Jane" age 25 city "NYC"
🗂️ Perfect for storing objects/records
⚡ O(1) for single field operations
💾 More memory efficient than JSON strings
🔍 Can fetch specific fields without entire object

Continue with Redis

Save the full cheat sheet or work through every related task.

More Redis tasks

Back to the full Redis cheat sheet