I am trying to remove and move multiple values from one Redis hash to another Redis hash in Node.js.
Basically I have two hashes set up: Current and History.
When I receive information that contains a 1 I store some string data into the Current hash. I continually do this until I receive info that contains a 0 or 2.
Then I want to remove all values from the Current hash that match this new message's string and put those into the History hash.
I am in the process of writing a function that just reads all the values from the Current Hash, compares their strings to the new info string, and then removes and adds when there is a match. But I already can see how this would be really inefficient if there was a lot of items in the Current Hash.
Is there a better way to remove multiple matching values in a hash and easily move them to a different hash?