I want to pop all list items from redis list at once.
I don't want to call lpop
or rpop
method by when the list is empty because it seems to be inefficient sending requests multi-time to redis-server
.
I also know that I can get all lists with lrange
method but not popping items.
Could you suggest me?
I just want to pop
and get
items in a list by one request to redis-server
.
As Itamar Haber said, use lrange and del. In pipe mode it will be done as a single command.
LRANGE key 0 -1
DEL key
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With