- Usage:
-
XDELEX key [ KEEPREF | DELREF | ACKED ] IDS numids id [ id ... ]
- Complexity:
- O(1) for each single item to delete in the stream, regardless of the stream size
- Since:
- 9.2.0
- ACL Categories:
- @fast, @write, @stream
KEEPREF(default): deletes the stream message but leaves pending entries list (PEL) references intact in all consumer groups,DELREF: deletes the stream message and forcibly removes it from all consumer group PELs,ACKED: deletes a message only once no consumer group still needs it, meaning none has it pending (each has either acknowledged it or never picked it up), and no group can still deliver it later.-
-1: The ID doesn't exist in the stream, or the key doesn't exist.
-
1: The entry was deleted.
-
2: The entry was not deleted because a consumer group still needs it (
ACKEDmode only).
The XDELEX command is an extension of the XDEL command that deletes one or more stream messages with control over how deletion affects consumer groups.
The command supports three deletion modes:
Examples
127.0.0.1:6899> XADD s4 * a 1
"1788346731590-0"
127.0.0.1:6899> XGROUP CREATE s4 grp 0
OK
127.0.0.1:6899> XREADGROUP GROUP grp cons1 COUNT 10 STREAMS s4 >
1) 1) "s4"
2) 1) 1) "1788346731590-0"
2) 1) "a"
2) "1"
127.0.0.1:6899> XDELEX s4 ACKED IDS 1 1788346731590-0
1) (integer) 2
127.0.0.1:6899> XLEN s4
(integer) 1
127.0.0.1:6899> XACK s4 grp 1788346731590-0
(integer) 1
127.0.0.1:6899> XDELEX s4 ACKED IDS 1 1788346731590-0
1) (integer) 1
127.0.0.1:6899> XLEN s4
(integer) 0
RESP2/RESP3 Reply
Array reply: a list of integer codes, one per requested ID, in the same order as the IDs are given.