XDELEX · Valkey

XDELEX

Delete stream message(s) with extended options

Usage

XDELEX key [KEEPREF | DELREF | ACKED] IDS numids id [id…]

Description

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:

Reply

Array of integer codes, one per requested ID, in the same order as the IDs are given.

Complexity

O(1) for each single item to delete in the stream, regardless of the stream size

ACL Categories

@fast @stream @write

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

History

See also

XACK, XACKDEL, XADD, XAUTOCLAIM, XCLAIM, XDEL, XGROUP, XGROUP CREATE, XGROUP CREATECONSUMER, XGROUP DELCONSUMER, XGROUP DESTROY, XGROUP HELP, XGROUP SETID, XINFO, XINFO CONSUMERS, XINFO GROUPS, XINFO HELP, XINFO STREAM, XLEN, XPENDING, XRANGE, XREAD, XREADGROUP, XREVRANGE, XSETID, XTRIM.