antirez/redis — Issue #197: New cmd request: atomic pull from list(s) into a set
Author: technomagos
Created: 2011-11-20 23:18:40+00:00
State: open

Suggestiong a primary atomic command that should be simple but powerful, as it will glue nicely 2 data types: list and set. :
(B)POP-from-LIST(s) and PUSH to SET
The most generic version of that will cover all uses is a "blocked pop from *possibly multiple* lists (queues) into a single set".

I can see a number of uses for this; a simple one is a reliable job queue: job queue is a list; once an item (job) is pulled, it is atomically placed in a "running jobs" set; this allows if the puller of the job crashes, another process to palce it back. Command to push into another list works btu this does not really work: as when the puller completes the job succesfully it will then need to remove from the "running queue" (which may have grown by another 100 elements; list is not the right type for such a pull.

I find this still possible to do this now but only via a few more commands instead of a single one and by keeping a lot more keys around. Or via some writing some logic outside. But the above command should allow this to be done very easily.

Sorry if i have missed something obvious.