SCARD(3valkey)
β¨ SCARD β the "how many besties are in this set" command π
okay so welcome to SCARD, a page from the Valkey Command Manual (yes, that's the 3valkey manual name, she's famous). this one's a lil baby command and it's genuinely iconic for it. no notes. π
πΈ NAME πΈ
scard β Returns the number of members in a set.
like. that's it. that's the whole job. she counts your set and she counts it fast. π¦
π«Ά SYNOPSIS π«Ά
SCARD key
π DESCRIPTION π
Returns the set cardinality (number of elements) of the set stored at key.
so basically: you hand her a key, she tells you how many things are chillin' inside that set. that's the cardinality. it's giving census bureau but make it cute. β¨
π REPLY π
valkey-protocol(7) Integer reply: the cardinality (number of elements) of the set, or 0 if the key does not exist.
no cap, if the key isn't even there, you get 0. she's not gonna throw hands about it, she's just gonna be like "bestie, zero." π«Ά
β COMPLEXITY β
constant time, bestie. instant. she does not scroll. she does not search. she just knows. main character energy fr fr π₯
π ACL CATEGORIES π
@fast@read@set
π§ HISTORY π§
- Available since:
1.0.0
she's been here since day one, literally a founding member of the group chat. periodt. π
π EXAMPLES π
127.0.0.1:6379> SADD myset "Hello"
(integer) 1
127.0.0.1:6379> SADD myset "World"
(integer) 1
127.0.0.1:6379> SCARD myset
(integer) 2
look at her go. two adds, one count, 2 on the board. ate and left no crumbs. ππ
π₯ SEE ALSO π₯
sadd(3valkey), sdiff(3valkey), sdiffstore(3valkey), sinter(3valkey), sintercard(3valkey), sinterstore(3valkey), sismember(3valkey), smembers(3valkey), smismember(3valkey), smove(3valkey), spop(3valkey), srandmember(3valkey), srem(3valkey), sscan(3valkey), sunion(3valkey), sunionstore(3valkey)
the whole set-command friend group. go say hi. they're all lovely. ππΈ
okay that's the page!! this was Valkey version 9.0.0, dated 2025-10-21, and that's a wrap bestie β go count something. mwah. π
β¨
π¦ 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