I want to pop multiple elements from a Redis list/queue in one call instead of issuing multiple LPOP or RPOP calls. I also want to only be able to do this if that many elements are actually there in the list. Is there a way to do with existing Redis commands? I know that this can be done using Redis functions/Lua scripting.

Comment From: sundb

LMPOP?

Comment From: aymanimtyaz

LMPOP will return a lesser number of elements if the specified number isn't there right? This is not the behavior that I want. I'd rather have an error be thrown saying not enough elements are there in the list.

Comment From: sundb

if so, it can only be implemented using lua.

Comment From: aymanimtyaz

Fair enough. Thank you for your help!