What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

LLEN

Returns the length of a list.

Usage
LLEN key
Complexity
O(1)
Since
1.0.0
ACL Categories
@fast, @list, @read
Command flags
READONLY, FAST

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.

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

Replies

RESP2

Integer reply: the length of the list.

RESP3

Integer reply: the length of the list.