0
0
Redisquery~20 mins

Key naming conventions (colons for namespacing) in Redis - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Redis Key Naming Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Why use colons in Redis key names?
In Redis, why do developers often use colons (:) in key names like user:1001:profile?
ABecause Redis requires colons to separate key parts
BTo create a clear hierarchy and group related keys logically
CTo make keys shorter and save memory
DTo encrypt the key names for security
Attempts:
2 left
💡 Hint
Think about how colons help organize keys for easier management.
query_result
intermediate
1:30remaining
Find keys with a specific namespace
Given Redis keys: user:1001:profile, user:1002:profile, order:5001:status, which command lists all keys related to users?
AKEYS user:*
BKEYS *:user:*
CKEYS user
DKEYS *user*
Attempts:
2 left
💡 Hint
Use a pattern that matches keys starting with 'user:'
📝 Syntax
advanced
2:00remaining
Identify the invalid Redis key name
Which of the following Redis key names is invalid or problematic due to naming conventions?
Auser::profile
Bconfig:system:version
Ccache:page:home
Dsession:abc123:token
Attempts:
2 left
💡 Hint
Look for unusual or repeated colons that might cause confusion.
optimization
advanced
2:30remaining
Optimizing Redis key design for large datasets
You have millions of user session keys like session:userid:token. Which key naming strategy helps improve Redis performance and memory usage?
AUse very long descriptive keys for clarity, e.g., <code>session:user:uniqueid:token</code>
BUse random characters instead of user IDs to avoid collisions
CUse short prefixes and avoid unnecessary parts, e.g., <code>s:uid:tok</code>
DUse spaces instead of colons to separate parts
Attempts:
2 left
💡 Hint
Shorter keys save memory and improve speed.
🔧 Debug
expert
3:00remaining
Troubleshoot key pattern matching issue
You want to delete all keys related to orders using DEL order:* but it doesn't delete any keys. Why?
ADEL command does not support wildcards; use KEYS with DEL instead
BKeys have spaces instead of colons, so pattern doesn't match
CRedis keys are case-sensitive and keys are uppercase
DDEL command requires a list of keys, not a pattern
Attempts:
2 left
💡 Hint
Think about how DEL works with patterns.