redis> SMEMBERS CO:1:A
1) "1"
2) "2"
redis> SMEMBERS CO:2:A
1) "1"
2) "5"
3) "6"
redis> SMEMBERS CO:3:A
1) "5"
redis> SMEMBERS CO:4:A
1) "1"
Now I want to find the keys where the value 1 exist
If I search with the values 1 then the result keys will be CO:1:A, CO:2:A
and CO:4:A
How to get This?
Redis is not a relational database. You need to anticipate this access path, and maintain a reverse index.
Now you can query in reverse way: