XLEN
Since 1.1.0Streams
Syntax
XLEN keyReturns the number of entries in the stream at key. It counts the entries the stream holds now: those removed by XDEL or XTRIM are not counted. XINFO STREAM reports entries-added, how many the stream has ever had.
A stream whose entries have all been deleted still exists, with a length of 0, unlike a list, which is deleted with its last element. That keeps its consumer groups and last ID.
Reply
- The number of entries;
0if the key does not exist. WRONGTYPEif the key holds another type.
Examples
> XADD s 1-0 a 1
"1-0"
> XADD s 2-0 a 2
"2-0"
> XLEN s
(integer) 2
> XDEL s 1-0 2-0
(integer) 2
> XLEN s
(integer) 0
> EXISTS s
(integer) 1
> XLEN nokey
(integer) 0