Groups
Groups
Sign in
Groups
Groups
Redis DB
Conversations
About
Send feedback
Help
hiredis redisCommand eval syntax
575 views
Skip to first unread message
Chris Love
unread,
Jun 1, 2012, 6:27:08 PM
6/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redi...@googlegroups.com
Hi all
I am using the hiredis client and attempting to run a eval.
Running the following:
<code>
reply = redisCommand(c, "eval \"return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}\" 2 key1 key2 first second");
printf("EVAL: %s\n", reply->str);
freeReplyObject(reply);
</code>
Gives me:
EVAL: ERR value is not an integer or out of range
I have seen this before when you mess up the second argument that you pass into the eval command. This eval command is right off of the website.
Thanks
Chris
Chris Love
unread,
Jun 1, 2012, 6:52:03 PM
6/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redi...@googlegroups.com
I figured it out with the help of a friend.
reply = redisCommand(c, "eval %s 1 %s", "return {KEYS[1]}", "key1");
if (reply->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < reply->elements; j++) {
printf("%u) %s\n", j, reply->element[j]->str);
}
}
printf("EVAL: %s\n", reply->str);
freeReplyObject(reply);
Reply all
Reply to author
Forward
0 new messages