Skip to content

Instantly share code, notes, and snippets.

@kristoff-it
Last active January 10, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristoff-it/8846868dda416753fda67ab3e4e60099 to your computer and use it in GitHub Desktop.
Save kristoff-it/8846868dda416753fda67ab3e4e60099 to your computer and use it in GitHub Desktop.
#include "redismodule.h"
int HelloWorld_Command(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_ReplyWithSimpleString(ctx, "Hello World!");
return REDISMODULE_OK;
}
int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
if (RedisModule_Init(ctx,"testmodule",1,REDISMODULE_APIVER_1)
== REDISMODULE_ERR){
return REDISMODULE_ERR;
}
if (RedisModule_CreateCommand(ctx,"test.hello", HelloWorld_Command,
"readonly", 0, 0, 0) == REDISMODULE_ERR){
return REDISMODULE_ERR;
}
return REDISMODULE_OK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment