In the previous blog has been very detailed introduction of the Redis of the various operation commands, operating mechanism and server initialization parameters configuration. This blog is the last of the series, where you will give a code example that accesses and operates a Redis server based on the Redis client component. It should be explained, however, that the following example can only run on the Linux/unix platform because the Redis does not provide a Windows platform client based on the C interface. But for developers who use other programming languages, such as C # and Java,redis, they provide client-side components for these languages, which, in turn, can be used for various interactions between windows-based platforms and Redis servers.
The client used in this blog comes from the Redis official website and is the Redis recommended client component based on C interface, see the following link:
Https://github.com/antirez/hiredis
In the following code example, two of the most commonly used REDIS command operations are given, both in normal invocation and based on the way the pipeline is invoked.
Note: Please note the comments when reading the code.
#include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <stdarg.h> #include <
string.h> #include <assert.h> #include