Reputation: 355
I'm looking for something similar to BLPOP, but instead of element I want to get them all run running over them in a loop. It means that I want to get all the records of redis collection, and truncate it.
Upvotes: 0
Views: 181
Reputation: 13089
Consider using a LUA script to do the LRANGE+DEL atomically.
Or use RENAME to move the list to a temporary key which you will use to process the data.
RENAME yourlist temp-list
LRANGE temp-list 0 -1
... process the list
DEL temp-list
Upvotes: 1