Je veux insérer des données à redis en C. J'ai trouvé hiredis bibliothèque.Comment utiliser la commande SADD dans hiredis?
j'ai écrit un exemple:
redisContext *c = redisConnect("127.0.0.1", 6379);
if (c != NULL && c->err)
{
printf("Error: %s\n", c->errstr);
// handle error
} else
{
printf("Connected to Redis\n");
}
redisReply *reply;
reply = (redisReply *)redisCommand(c, "AUTH 123456");
if(reply->type==5)
{
reply = (redisReply *)redisCommand(c,"SET %d %d",32,111);
freeReplyObject(reply);
reply = (redisReply *)redisCommand(c,"GET %d",32);
printf("%s\n",reply->str);
int ii = redisAppendCommand(c,"SADD %d %d",32,33);// MY PROBLEM IS HERE
printf("-------SADD---------------- %d\n",ii);
Je ne sais pas comment utiliser la commande SADD. Aidez-moi, s'il vous plaît.