0
0
Redisquery~30 mins

Key naming conventions (colons for namespacing) in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Key Naming Conventions with Colons for Namespacing in Redis
📖 Scenario: You are managing a Redis database for an online bookstore. You want to organize your keys clearly so you can easily find and manage data related to books, authors, and users.
🎯 Goal: Build a set of Redis keys using colons : to separate namespaces, making it easy to identify and group related data.
📋 What You'll Learn
Create keys for books, authors, and users using colons to separate namespaces
Use a consistent pattern for keys like category:id:property
Store simple string values for each key
💡 Why This Matters
🌍 Real World
Using colons in Redis keys is a common way to organize data in real applications like online stores, social media, or content management systems.
💼 Career
Understanding key naming conventions helps you write clear, maintainable Redis code that teams can easily understand and extend.
Progress0 / 4 steps
1
Create book keys with namespacing
Create three Redis keys for books using colons for namespacing. Use the pattern book:1:title, book:1:author, and book:1:year. Set their values to 'The Great Gatsby', 'F. Scott Fitzgerald', and '1925' respectively.
Redis
Need a hint?

Use the SET command with keys like book:1:title and the exact values given.

2
Add author keys with namespacing
Create two Redis keys for the author using colons for namespacing. Use the pattern author:1:name and author:1:nationality. Set their values to 'F. Scott Fitzgerald' and 'American' respectively.
Redis
Need a hint?

Use the SET command with keys like author:1:name and the exact values given.

3
Create user keys with namespacing
Create two Redis keys for a user using colons for namespacing. Use the pattern user:100:username and user:100:email. Set their values to 'reader123' and 'reader123@example.com' respectively.
Redis
Need a hint?

Use the SET command with keys like user:100:username and the exact values given.

4
Add a key to track user book favorites
Create a Redis key user:100:favorites to store a comma-separated string of favorite book IDs. Set its value to '1,2,3'.
Redis
Need a hint?

Use the SET command with the key user:100:favorites and value '1,2,3'.