llen.3valkey - Man Page

Returns the length of a list.

Synopsis

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

valkey-protocol(7) Integer reply: the length of the list.

Complexity

O(1)

Acl Categories

@fast @list @read

History

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

See Also

blmove(3valkey), blmpop(3valkey), blpop(3valkey), brpop(3valkey), lindex(3valkey), linsert(3valkey), lmove(3valkey), lmpop(3valkey), lpop(3valkey), lpos(3valkey), lpush(3valkey), lpushx(3valkey), lrange(3valkey), lrem(3valkey), lset(3valkey), ltrim(3valkey), rpop(3valkey), rpush(3valkey), rpushx(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual