BLMOVE

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Move data between lists - blocking

Pops an element from the source list and pushes it to the destination list.
Specify left/right when popping from the source list, and left/right when pushing to the destination list. LEFT can be read as first or head of the list, and RIGHT as last or tail.
Like other blocking commands, if there is no data it waits until data arrives (timeout).

Example: Reliable queue

Command>lpush src_key msg_1 msg_2 msg_3
Result>3
Command>lpush dest_key msg_A msg_B msg_C
Result>3
Command>blmove src_key dest_key left left 5
Result>msg_3
Command>lrange src_key 0 -1
Result> 1) "msg_2"
2) "msg_1"
Command>lrange dest_key 0 -1
Result> 1) "msg_3"
2) "msg_C"
3) "msg_B"
4) "msg_A"


Syntax

BLMOVE source destination LEFT|RIGHT LEFT|RIGHT timeout

  • Available since version 6.2.0.
  • Time complexity is O(1).
Related commands LMOVE

<< BRPOP BLMOVE BRPOPLPUSH >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.