I am a new in Redis and key-value database. Could you advise me about correct realization this relational approach in redis.
I have relational table with two key to one value:
-master_id; -slave_id; -value.
Example:
master_id | slave_id | value
1 | 1 | val1
2 | 1 | val2
Usually access to values is done by master_id field, but sometimes it is necessary make selection (or deleting) by slave_id field. Thus we can obtain a single value by two fields (master_id or slave_id). In redis, as I understand every single key mean one value. What the best way to perform this, without duplication of value? NOTE: value field must be a SET or list type.
In redis we have:
1:1 val1 2:1 val2
And I can make access to value only by a full key 1:1 or 2:1. I can't make something like this DEL * :1 (delete all keys where second part equal 1) or GET 1: * (get all keys where first part of keys equal 1)