LLEN(3valkey)
β¨ LLEN β¨
okay bestie, this is the llen page from the valkey command manual (manual name valkey, section 3 β we stan a classic) and it's literally the easiest thing you'll read all day π
π¦ NAME π¦
llen β returns the length of a list. that's it. that's the whole job. and she does it flawlessly π
πΈ SYNOPSIS πΈ
LLEN key
one argument. one. we love a low-maintenance icon π
π DESCRIPTION π
so here's the tea: LLEN hands you back the length of the list stored at key.
but wait, there's a plot twist for the nonexistent-key girlies: if key does not exist, it gets interpreted as an empty list, and you get 0 back. no drama, no error, just a chill little zero π«Ά
and now the *un*chill part β if the value stored at key is not a list, you get an error. so if you're out here running LLEN on a string, bestie, that's not it π she will not be nice about it.
π REPLY π
valkey-protocol(7) Integer reply: the length of the list. just a whole number, sparkling and correct β
π COMPLEXITY π
constant time!! instant!! no scanning, no searching, she already knows. main character speed fr fr π₯
π ACL CATEGORIES π
@fast @list @read
so: she's fast, she's a list girl, and she's read-only. a whole vibe check passed with flying colors β
π§ HISTORY π§
- Available since:
1.0.0
she's been here since day one. a true original. an elder stateswoman. respect her π
π EXAMPLES π
look how cute this is:
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 how that works?? you push "World" in, you got 1. you push "Hello" in, you got 2. then LLEN mylist says 2. she counted. she always counts. obsessed π
π SEE ALSO π
go read these next, bestie, the whole list squad is here:
blmove(3valkey)blmpop(3valkey)blpop(3valkey)brpop(3valkey)brpoplpush(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)rpoplpush(3valkey)rpush(3valkey)rpushx(3valkey)
heads up bestie: ifkeyholds something that is not a list,LLENreturns an error. don't shoot the messenger π
and that's the page!! version 9.0.0, dated 2025-10-21 β go count some lists, you absolute legend π¦β¨π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms