Hiredis is a minimalistic C client library for Redis that provides protocol support and command execution through a high-level printf-like API.
The library solves the problem of communicating with Redis from C applications by implementing the binary-safe Redis protocol. Rather than requiring explicit bindings for every Redis command, hiredis uses a printf-alike interface that works across all commands. The core design separates the reply parser from the I/O layer, creating a stream parser that can be reused in higher-level language bindings for efficient protocol parsing.
Hiredis suits projects that need direct C access to Redis without heavy abstraction layers. It works well for applications requiring minimal dependencies or those building language bindings where the decoupled parser can be leveraged. The library supports three distinct APIs: synchronous for blocking operations, asynchronous for non-blocking use, and a standalone reply parsing API. It maintains compatibility with Redis versions 1.2.0 and later through its binary-safe protocol implementation.
The project maintains active development with attention to protocol compliance and signal handling. Recent changes improved how the library handles interrupted system calls during connection establishment, retrying until the connection succeeds or the timeout is reached rather than immediately failing. The maintainers have introduced support for additional numeric types in protocol responses, including NaN values alongside infinity representations. Breaking changes across major versions reflect deliberate API refinement, such as renaming timeout configuration options for clarity and adjusting parameter types for consistency with modern C practices.