XDEL

    Removes the specified entries from a stream, and returns the number of entries deleted. This number may be less than the number of IDs passed to the command in the case where some of the specified IDs do not exist in the stream.

    Redis streams are represented in a way that makes them memory efficient: a radix tree is used in order to index macro-nodes that pack linearly tens of stream entries. Normally what happens when you delete an entry from a stream is that the entry is not really evicted, it just gets marked as deleted.

    In future versions of Redis it is possible that we’ll trigger a node garbage collection in case a given macro-node reaches a given amount of deleted entries. Currently with the usage we anticipate for this data structure, it is not a good idea to add such complexity.

    1. 1538561698944-0
    2. dragonfly> XADD mystream * b 2
    3. dragonfly> XADD mystream * c 3
    4. dragonfly> XDEL mystream 1538561700640-0
    5. (integer) 1
    6. dragonfly> XRANGE mystream - +
    7. 1) 1) 1538561698944-0
    8. 2) 1) 1538561701744-0
    9. 2) 1) "c"
    10. 2) "3"