Skip to main content
#

Boolean

RESP3

prefix: #  ·  client type: bool / Boolean / true/false

RESP3 type – requires HELLO 3 at connection startup to activate. RESP2 clients will not receive this type.

RESP3 booleans encode true and false explicitly: #t\r\n and #f\r\n. In RESP2, boolean-semantic commands returned integers (1=true, 0=false). RESP3 booleans let clients receive proper boolean types for commands like SISMEMBER, HEXISTS, and EXPIRE without knowing the command's boolean-integer convention.

Details

RESP3 boolean values: #t\r\n – true #f\r\n – false

In RESP2, EXISTS and SISMEMBER returned :1 or :0. Clients that received these replies had to know the command name to interpret them as booleans rather than counts. RESP3 makes the type explicit.

Client implementations for languages without boolean types (C): should use 0/1 integers and document the type.

In Redis 7.2+, commands that previously returned 1/0 for boolean semantics (SISMEMBER, HEXISTS, EXPIRE, PERSIST, etc.) return #t/#f when the client has upgraded to RESP3.

Wire encoding

Wire bytes (CRLF shown as \\r\\n)
#t\r\n    # true
#f\r\n    # false

Type information

Prefix byte#
VersionRESP3
Client typebool / Boolean / true/false
SpecificationRESP3 specification (GitHub) →

Redis commands returning this type

SISMEMBERHEXISTSEXPIREPERSISTMSETNX

See Also