0
0
Redisquery~20 mins

Why key management matters in Redis - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Redis Key Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is consistent key naming important in Redis?

Imagine you store user data in Redis. Why should you use a consistent naming pattern for keys?

AIt automatically encrypts the data stored under those keys.
BIt helps avoid key collisions and makes data easier to find.
CIt increases the speed of Redis commands by changing internal algorithms.
DIt allows Redis to store keys in multiple databases simultaneously.
Attempts:
2 left
💡 Hint

Think about how you find things in a messy room versus a tidy one.

query_result
intermediate
2:00remaining
What keys will the command return?

Given these keys in Redis: 'user:1:name', 'user:2:name', 'session:1', 'user:1:email', what does the command KEYS user:1:* return?

A['user:1:name', 'user:1:email']
B[]
C['session:1']
D['user:1:name', 'user:2:name', 'user:1:email']
Attempts:
2 left
💡 Hint

The asterisk (*) matches any characters after 'user:1:'.

📝 Syntax
advanced
2:00remaining
Identify the syntax error in this Redis command

Which option shows a Redis command with a syntax error?

Command: SET user:100 name 'Alice'

ASET user:100:name Alice
BSET user:100:name 'Alice'
CSET user:100 name 'Alice'
D'ecilA' eman:001:resu TES
Attempts:
2 left
💡 Hint

Remember the SET command syntax: SET key value

optimization
advanced
2:00remaining
Which key design improves Redis memory usage?

You want to store session data for millions of users. Which key design is best to reduce memory usage?

AUse short keys like 's:userid' and store all session data in hashes.
BUse long descriptive keys like 'user:session:data:region:country:userid'.
CUse random UUIDs as keys without any pattern.
DStore all sessions in one big JSON string under a single key.
Attempts:
2 left
💡 Hint

Think about key length and data structure efficiency.

🔧 Debug
expert
3:00remaining
Why does this Redis key expire unexpectedly?

You set a key with SET user:123:name 'Bob' EX 3600. Later, you run DEL user:123:name and then SET user:123:name 'Bob' without expiration. But the key still expires after 1 hour. Why?

AYou must restart Redis to clear expiration timers on keys.
BRedis caches the expiration time and applies it to new keys automatically.
CThe second SET command did not remove the expiration, so the TTL remains.
DThe DEL command failed silently, so the old key with expiration still exists.
Attempts:
2 left
💡 Hint

Check how Redis handles expiration when overwriting keys.