0
0
Redisquery~10 mins

Denormalization for speed in Redis - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a user's name in Redis.

Redis
redis.call('SET', 'user:[1]:name', 'Alice')
Drag options to blanks, or click blank then click option'
Aname
B123
Cuser
Dprofile
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic words like 'user' or 'name' without an ID causes key collisions.
2fill in blank
medium

Complete the code to retrieve the user's email from Redis.

Redis
local email = redis.call('GET', 'user:[1]:email')
Drag options to blanks, or click blank then click option'
Auser
Bprofile
Cemail
D456
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'email' or 'user' as the ID part of the key instead of the actual user ID.
3fill in blank
hard

Fix the error in the code to increment the user's login count.

Redis
redis.call('[1]', 'user:789:login_count')
Drag options to blanks, or click blank then click option'
AINCR
BSET
CGET
DDEL
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET replaces the value instead of incrementing it.
Using GET only reads the value without changing it.
4fill in blank
hard

Fill both blanks to store a user's profile with denormalized data.

Redis
redis.call('[1]', 'user:[2]', 'name', 'Bob', 'email', 'bob@example.com')
Drag options to blanks, or click blank then click option'
AHMSET
BSET
C101
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET only stores a single string, not multiple fields.
Using a generic key like 'user' without an ID causes data overwrite.
5fill in blank
hard

Fill all three blanks to create a denormalized Redis key for fast access.

Redis
redis.call('[1]', 'order:[2]:[3]', 'status', 'shipped')
Drag options to blanks, or click blank then click option'
AHMSET
B789
Cuser123
DSET
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET stores only a string, not multiple fields.
Missing user ID in the key reduces denormalization benefits.