LLEN · Valkey

LLEN

Returns the length of a list.

Usage

LLEN key

Description

Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned. An error is returned when the value stored at key is not a list.

Reply

Integer reply: the length of the list.

Complexity

O(1)

ACL Categories

@fast @list @read

Examples

127.0.0.1:6379> LPUSH mylist "World"
(integer) 1
127.0.0.1:6379> LPUSH mylist "Hello"
(integer) 2
127.0.0.1:6379> LLEN mylist
(integer) 2

History

See also

BLMOVE, BLMPOP, BLPOP, BRPOP, LINDEX, LINSERT, LMOVE, LMPOP, LPOP, LPOS, LPUSH, LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP, RPUSH, RPUSHX.