Skip to main content

LLEN

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.

Syntax

LLEN key

Details

  • Available since: 1.0.0
  • Time complexity: O(1)
  • ACL categories: @read, @list, @fast

Examples

First, add some elements to a list:

LPUSH mylist "World"
LPUSH mylist "Hello"

Then retrieve the length of the list:

LLEN mylist

This will output:

(integer) 2

RESP2/RESP3 Reply

Integer reply: the length of the list.

See Also