HSCAN(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

🌸 HSCAN (from the valkey command manual, bestie) 🌸

✨ NAME ✨

hscan β€” it iterates over fields and values of a hash. That's it, that's the whole job, and she does it flawlessly πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES]

Real talk: if you want the actual HSCAN documentation, go read valkey-scan(7) SCAN. Like, the SCAN page. It's all there, iykyk 🫢


πŸ’– REPLY πŸ’–

You get a valkey-protocol(7) Array reply back β€” a two-element array, periodt. And here's what's inside:

  • The first element is a valkey-protocol(7) Bulk string reply that represents an unsigned 64-bit number β€” that's your cursor, bestie πŸ”’
  • The second element is a valkey-protocol(7) Array reply of the field/value pairs that got scanned. But wait β€” when the NOVALUES option is on, it's a list of keys from the hash instead πŸ‘‘

πŸ”₯ COMPLEXITY πŸ”₯

  • O(1) for every single call. Every one. Snappy.
  • O(N) for a complete iteration β€” and that includes enough command calls for the cursor to come all the way back to 0. N is the number of elements inside the collection, no cap πŸ“Š

πŸŽ€ ACL CATEGORIES πŸŽ€

@hash @read @slow


🌈 HISTORY 🌈

  • Available since: 2.8.0 β€” she's been iconic since day one, fr fr ✨

πŸ‘‘ SEE ALSO πŸ‘‘

hdel(3valkey), hexists(3valkey), hexpire(3valkey), hexpireat(3valkey), hexpiretime(3valkey), hget(3valkey), hgetall(3valkey), hgetex(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hmset(3valkey), hpersist(3valkey), hpexpire(3valkey), hpexpireat(3valkey), hpexpiretime(3valkey), hpttl(3valkey), hrandfield(3valkey), hset(3valkey), hsetex(3valkey), hsetnx(3valkey), hstrlen(3valkey), httl(3valkey), hvals(3valkey)


Okay that's the whole page, you ate it up πŸ’œ This was 9.0.0, dated 2025-10-21 β€” mwah, go scan some hashes, main character πŸ§šπŸ’–

πŸ“¦ where this page comes from