LLEN
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.
Return value
Section titled “Return value”| 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.
Examples
Section titled “Examples”127.0.0.1:6379> RPUSH queue a b c(integer) 3127.0.0.1:6379> LLEN queue(integer) 3127.0.0.1:6379> LLEN nosuchkey(integer) 0Compatibility
Section titled “Compatibility”Same as Redis 7.4 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.