How does redis search for field values?

the data is designed as follows:

assume that the user information is stored below,

127.0.0.1:6379> HMSET user:1 username  age 11 status 1
OK
127.0.0.1:6379> HMSET user:2 username  age 12 status 0
OK
127.0.0.1:6379> HMSET user:3 username  age  11 status 1
OK
127.0.0.1:6379> HMSET user:4 username  age 13 status 0
OK

so I want to use the value of the status field to find out what all status=1 users should do. Or there is a problem with such a design. Thank you for your guidance.

Mar.14,2021

redis itself does not support such an operation! Then you might as well use elasticsearch


suggest new set: key-> status value- > userid

Menu