BITFIELD_RO
BITFIELD_RO key [GET encoding offset ...]
- Group
- Bitmap
- Complexity
- O(1) for each GET
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
BITFIELD_RO runs only GET operations of BITFIELD.
Because it never writes, it is flagged read-only, so you can send it to
read-only replicas and use it where write commands are not allowed. The
encodings and offsets are the same as for BITFIELD. A missing key reads as
zeros.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Array with one integer per GET |
Array |
Errors:
ERR BITFIELD_RO only supports the GET subcommandfor any other operation.- The encoding and offset errors of BITFIELD.
WRONGTYPEwhen the key holds a value that is not a string.
Examples
Section titled “Examples”127.0.0.1:6379> BITFIELD counters SET u8 0 255 SET i8 #1 -51) (integer) 02) (integer) 0127.0.0.1:6379> BITFIELD_RO counters GET u8 0 GET i8 #11) (integer) 2552) (integer) -5127.0.0.1:6379> BITFIELD_RO counters INCRBY u8 0 1(error) ERR BITFIELD_RO only supports the GET subcommandCompatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.