A minimalistic C client library for Redis, featuring synchronous, asynchronous, and reply parsing APIs.
Hiredis is a minimalistic C client library for Redis, designed to facilitate communication with Redis servers through a simple yet powerful API. It solves the problem of integrating Redis into C applications by providing synchronous, asynchronous, and reply parsing interfaces, all while maintaining a small code footprint and high performance.
C developers building applications that require efficient Redis database interactions, including embedded systems, high-performance servers, and language bindings for other programming languages.
Developers choose Hiredis for its balance of minimalism and functionality, offering a straightforward API that reduces complexity without sacrificing features like SSL/TLS support, RESP3 compliance, and asynchronous operation, making it the de facto standard C client for Redis.
Minimalistic C client for Redis >= 1.2
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Hiredis is designed to be lightweight with a small codebase, minimizing overhead and making it ideal for embedded systems or performance-critical applications, as highlighted in its minimalist philosophy.
Offers synchronous, asynchronous, and reply parsing APIs, allowing developers to choose between blocking calls, event-driven designs with libev/libevent, and custom parsing for language bindings.
Completely compatible with Redis Serialization Protocol version 3, including new data types like maps, sets, and push notifications, ensuring future-proofing for modern Redis features.
Supports secure connections via optional OpenSSL binding, though it requires explicit build flags and linking against separate libraries, as detailed in the SSL/TLS section.
Allows injection of custom memory allocation functions through hiredisAllocFuncs, enabling integration with specialized memory management systems without modifying core library code.
Upgrading between major versions, such as from 0.14.1 to 1.0.0, involves API breaks like renamed fields and added members, requiring code updates and recompilation, as warned in multiple 'IMPORTANT' sections.
Does not include built-in connection pooling, automatic reconnection, or command retries, forcing developers to implement these manually, which increases boilerplate code for production use.
Enabling SSL/TLS requires building with USE_SSL=1, linking against OpenSSL, and managing separate contexts, adding steps and dependencies that complicate deployment compared to all-in-one clients.
The README explicitly states that redisContext and redisAsyncContext are not thread-safe, necessitating external synchronization in multi-threaded applications, which can lead to bugs if overlooked.