hiredis and pipeline

120 views
Skip to first unread message

James Charles

unread,
May 12, 2021, 12:09:56 PM5/12/21
to redi...@googlegroups.com
Hi,
I use hiredis as the client. GET and SET are mixed in my input file.
For example, each SET is followed by a GET. I am trying to use
pipeline in hiredis to speed up. I want to put 100 commands together
and then send them to Redis in the pipeline. The line is the command
from my input file, when the first letter is S, it will need SET,
otherwise is GET. The implementation is below. I run the codes and
nothing is added to Redis. Any help would be appreciated.

while ((read = getline(&line, &len, fptr)) != -1)
{ count++;
if (count > 100)
{
freeReplyObject(reply);
count = 0;
}
if (line[0] == 'S')
{
redisAppendCommand(c, "SET %s %s", line, "valuekv");
}
else {
redisAppendCommand(c, "GET %s", line);
}
}

Jonathan Mendoza

unread,
May 13, 2021, 8:14:45 AM5/13/21
to redi...@googlegroups.com
redisGetReply(context,(void *)&reply); // reply for SET

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/CADN%2BnusP_zx_4b%3D-xBVksAOtBCf5quOtK%3DkeLTpoQAouJvVOcg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages