BITFIELD_RO(3valkey)

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

πŸ’– BITFIELD_RO (3valkey) πŸ’–

okay bestie, welcome to the Valkey Command Manual page for bitfield_ro β€” she's cute, she's read-only, she's giving ✨*immaculate vibes*✨


🌸 NAME 🌸

bitfield_ro β€” performs arbitrary read-only bitfield integer operations on strings. no writes, no drama, just reading πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

BITFIELD_RO key [GET encoding offset [GET encoding offset ...]]

πŸ¦‹ DESCRIPTION πŸ¦‹

so this is the read-only variant of the valkey-bitfield(7) BITFIELD command. like, it's basically the same girl as the original BITFIELD, except she only accepts the GET subcommand, and she can be used safely on read-only replicas. no cap 🫢

here's the tea though: because the original BITFIELD has SET and INCRBY options, it's technically flagged as a writing command in the Valkey command table. which means read-only replicas in a Valkey Cluster will redirect it to the master instance even if the connection is in read-only mode (that's the valkey-readonly(7) READONLY command of Valkey Cluster, iykyk). so rude of it honestly 😭

see original BITFIELD for more details πŸ‘‘

example moment, because we love a demo:

BITFIELD_RO hello GET i8 16

⭐ REPLY ⭐

valkey-protocol(7) Array reply: each entry being the corresponding result of the sub-command given at the same position. one subcommand in, one result out, perfectly matched, as she should πŸ’…βœ¨


🌈 COMPLEXITY 🌈

O(1) for each subcommand specified. constant time per subcommand, we love an efficient queen πŸ‘‘


πŸ’œ ACL CATEGORIES πŸ’œ

@bitmap @fast @read


πŸ“ HISTORY πŸ“

  • Available since: 6.0.0

🧚 SEE ALSO 🧚

bitcount(3valkey), bitfield(3valkey), bitop(3valkey), bitpos(3valkey), getbit(3valkey), setbit(3valkey)


and that's the whole page bestie!! version 9.0.0, dated 2025-10-21 β€” go forth and read your bitfields, you absolute icon πŸ’–πŸŽ€πŸ¦‹β­πŸ’…

πŸ“¦ where this page comes from