Can I reuse redisReply? #1018
Replies: 2 comments
-
HI 👋 I'm honestly not exactly sure how you intend to reuse the reply. redisCommand returns a redis reply: redisReply *reply = redisCommand(context, "SET %s %s", "foo", "bar"); So calling it as you do above wouldn't compile. You can reuse replies as input to subsequent commands: reply1 = redisCommand(context, "GET %s", "somekey");
reply2 = redisCommand(context, "SET %s %s", "otherkey", reply->str); It's not possible to re-use the malloc'd |
Beta Was this translation helpful? Give feedback.
-
Thank you for looking at this. Investigating if it's a bottleneck first is a valid point. thank you. (and thank you ALL for this nice package) |
Beta Was this translation helpful? Give feedback.
-
Can I reuse a redisReply object so in order to improve efficiency of storing lots of data?
I am thinking something like:
instead of:
One way to implement this would be that each call to
redisCommand(redconn, &reply, "SET ...");
checks if*reply == NULL
, if it is then it malloc's it, if it isn't it just resets it and reuses it. Faster perhaps?Beta Was this translation helpful? Give feedback.
All reactions