Skip to content

Instantly share code, notes, and snippets.

@antmat
Created March 14, 2014 07:40
Show Gist options
  • Save antmat/9543549 to your computer and use it in GitHub Desktop.
Save antmat/9543549 to your computer and use it in GitHub Desktop.
#include <hiredis/hiredis.h>
#include <cstdlib>
#include <cstring>
#define NUM_KEYS 5000000
int main() {
struct timeval timeout = {1,0};
redisContext* context = redisConnectWithTimeout("127.0.0.1", 6379, timeout);
char** data = new char*[NUM_KEYS]; //50 mb
size_t* sizes = new size_t[NUM_KEYS];
sizes[0] = 4;
data[0] = (char*)malloc(5);
strcpy(data[0], "MGET");
for(size_t i=1; i<NUM_KEYS; i++) {
data[i] = new char[10];
strcpy(data[i], "123456789");
sizes[i] = 9;
}
redisReply* reply;
reply = (redisReply*)redisCommandArgv(context, NUM_KEYS, (const char**)data, sizes);
printf("Error: %s", context->errstr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment