I need to save list of tuples like [ ('name1', number1), ('name2', number2), ] into Redis.
At the same time there may be complete duplicates among the records (that is, both name and number may coincide) and duplicates must be saved too.
Also it should be possible to select records by the range of numbers.
I use a sorted set for this task for now with number as the score, so that I can easily get the range of numbers by ZRANGEBYSCORE. To be able to save duplicates, I add the generated id to the name. It turns out a dictionary like this before inserting into Redis:
{
'id1:name1': number1,
'id2:name2': number2,
}
Am I doing something stupidly wrong and there are more suitable data types in Redis for my task?