Contenido del Curso
Introduction to Redis
Introduction to Redis
Challenge: Managing User Interests
Imagine you are developing a feature for an application that tracks user interests. Information about each user is stored in Redis as a set. Each user has a unique collection of interests.
Add the interests for each user to their respective sets :
user:1:interests
: " music ", " movies ", " sports ";user:2:interests
: " sports ", " travel ", " reading ";user:3:interests
: " reading ", " music ", " cooking ".
Check if User 1 is interested in " travel " and if User 2 is interested in " sports ";
Identify the common interests of User 1 and User 2 ;
Find the interests of User 1 that are not shared by User 2 ;
Create a list of all unique interests shared by User 1 , User 2 , and User 3 ;
User 3 has stopped being interested in " music ." Remove this interest from their set ;
Display the list of interests for each user after performing these operations.
1. Add interests for each user to their respective sets:
python
2. Verify if a specific interest exists in a user's set:
python
3. Retrieve shared interests between two users:
python
4. Get interests of one user that are not shared by another:
python
5. Create a full list of unique interests from all users:
python
6. Delete an interest from a user's set:
python
7. Retrieve the updated sets of interests for each user:
python
¡Gracias por tus comentarios!