1

Let's suppose I have the following three k/v pairs:

user+123 = {
   'name': 'tom',
   'company': 'nike'
   'status': 0
}

user+199 = {
   'name': 'sarah',
   'company': 'nike'
   'status': 0
}

user+359 = {
   'name': 'brad',
   'company': 'nike'
   'status': 0
}

But suppose there may be any number of these user ids (actually, there would be various other object types, such as users, companies, documents, etc.) and it could be many million.

What would be the most efficient to do the following update:

update user* set status=1 where company=nike

For example, to do it for one object I could do:

r.set('user+123') = {
   'name': 'tom',
   'company': 'nike'
   'status': 1 // changed here
}

Perhaps a solution showing how to use redis search would be the best approach here? As opposed to having to iterate through all objects and check the values of the objects.

0 Answers0