Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

LLEN

Last updated
LLEN key
Group
List
Complexity
O(1)
Arity
2 (exactly, counting the command name)
Flags
read-only, fast
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

LLEN returns the number of elements in the list stored at key.

Case RESP2 RESP3
List exists Integer: the length Same
Key does not exist Integer 0 Same

LLEN replies with a WRONGTYPE error if key holds a value that is not a list.

127.0.0.1:6379> RPUSH queue a b c
(integer) 3
127.0.0.1:6379> LLEN queue
(integer) 3
127.0.0.1:6379> LLEN nosuchkey
(integer) 0

Same as Redis 7.4 and Valkey 8.

LRANGE, LINDEX, RPUSH