C and Redis
Find tutorials, examples and technical articles that will help you to develop with Redis and C.
#
Getting StartedIn order to use Redis with C, you need a C Redis client. For your first steps with C and Redis, this article will show how to use the recommended library: hiredis.
- hiredis
Hiredis is a minimalistic C client library for the Redis database.It is minimalistic because it just adds minimal support for the protocol, but at the same time it uses a high level printf-alike API in order to make it much higher level than otherwise suggested by its minimal code base and the lack of explicit bindings for every Redis command.
#
Step 1. Install the pre-requisitesVersion 1.0.0 marks the first stable release of Hiredis. Follow the below steps to install the pre-requisite packages in order to compile the latest version of hiredis.
Run the below command to run Redis server
#
Step 2. Install and compile hiredis#
Step 3. Copy the below C code:#
Step 4. Compile the code#
Step 5. Test the code#
More C Clients Resources- hiredis-cluster - C client library for Redis Cluster
libredis - A C based general low-level PHP extension and client library for Redis, focusing on performance, generality and efficient parallel communication with multiple Redis servers.
hiredispool - Provides connection pooling and auto-reconnect for hiredis. It is also minimalistic and easy to do customization.