ZSCAN(3valkey)
β¨ ZSCAN β¨
okay bestie, welcome to ZSCAN π this is a page from the valkey command manual (section 3valkey, iykyk) and it's literally about iterating over members and scores of a sorted set π¦
πΈ NAME πΈ
zscan β iterates over members and scores of a sorted set. that's the whole vibe. π
π SYNOPSIS π
ZSCAN key cursor [MATCH pattern] [COUNT count] [NOSCORES]
See SCAN for ZSCAN documentation. (yes bestie, the real lore lives over there, this page is the cute little redirect-with-extras situation π )
π REPLY π
it gives you back a valkey-protocol(7) Array reply: a two-element array. two elements. that's it. π«Ά
- the first element is a
valkey-protocol(7)Bulk string reply that represents an unsigned 64-bit number β that's your cursor, bestie, hold onto it fr fr. - the second element is a
valkey-protocol(7)Array reply of member/score pairs that were scanned. but β¨ when theNOSCORESoption is on β¨ it's just a list of members from the sorted set. no scores, no problem. π
β COMPLEXITY β
- O(1) for every call. every single one. iconic.
- O(N) for a complete iteration, including enough command calls for the cursor to return back to
0. and N is the number of elements inside the collection. so like, the more stuff you got, the longer the full loop takes. math is math. π
π ACL CATEGORIES π
@read @slow @sortedset
π¦ HISTORY π¦
- available since: 2.8.0 π±
- changed in 8.0.0: added
noscoresoption. glow up era. β¨
π SEE ALSO π
go read these too, bestie, they're all in the sorted set cinematic universe π
bzmpop(3valkey),bzpopmax(3valkey),bzpopmin(3valkey),zadd(3valkey),zcard(3valkey),zcount(3valkey),zdiff(3valkey),zdiffstore(3valkey),zincrby(3valkey),zinter(3valkey),zintercard(3valkey),zinterstore(3valkey),zlexcount(3valkey),zmpop(3valkey),zmscore(3valkey),zpopmax(3valkey),zpopmin(3valkey),zrandmember(3valkey),zrange(3valkey),zrangebylex(3valkey),zrangebyscore(3valkey),zrangestore(3valkey),zrank(3valkey),zrem(3valkey),zremrangebylex(3valkey),zremrangebyrank(3valkey),zremrangebyscore(3valkey),zrevrange(3valkey),zrevrangebylex(3valkey),zrevrangebyscore(3valkey),zrevrank(3valkey),zscore(3valkey),zunion(3valkey),zunionstore(3valkey)
okay that's the whole page, bestie, you ate that reading session fr fr π β¨
this little love letter came from Valkey Command Manual, version 9.0.0, dated 2025-10-21 β mwah, go forth and scan responsibly π«Άπ
π¦ 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