I want to store a hash/JSON data of users in Redis and want to add the user in users hash the user data like this.
For example, users = {}
;
When user rahul logs in then users
will become.
users = {
rahul: {
username: 'rahul',
}
}
And when user namita login then
users = {
rahul: {
username: 'rahul',
},
namita: {
username: 'namita',
}
}
What will the code be to do this in Redis?
How will I initialise the key users
and add rahul to it?
Out of this set, hset, etc., which function do I need to use?
And how will I retrieve the data of users['rahul']
via Redis?