My task is to get the list of animals (for example) for a specific user_id.
I don't want to use set/list for each user.
I have tried to use hash where each field is a user_id and each value is a concatenated string of animals. For example: {"1234" : "dog cat", "8477" : "bird dog"}
. Here, I can get the animals for user "1234", with just one call to Redis.
I know there is an APPEND command, that appends items to a string. But this is not working for appending to value inside a hash.
I have also tried to use set, and get the values by prefix. For the example above, my set would contain: ("1234:dog", "1234:cat", "8477:bird", "8477:dog")
. In order to get all animals for user "1234", I need to search for prefix "1234:". But this is not scale when I have too many items.
What can I do in order to complete my task?