Last active
May 9, 2019 11:37
-
-
Save kristoff-it/f8b2640ce024b7e1ebe71831f3166837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const redis = @import("./redismodule.zig"); | |
export fn HelloWorld_Command(ctx: *redis.RedisModuleCtx, argv: [*c]*redis.RedisModuleString, argc: c_int) c_int { | |
_ = redis.RedisModule_ReplyWithSimpleString(ctx, c"Hello World!"); | |
return redis.REDISMODULE_OK; | |
} | |
export fn RedisModule_OnLoad(ctx: *redis.RedisModuleCtx, argv: [*c]*redis.RedisModuleString, argc: c_int) c_int { | |
if (redis.RedisModule_Init(ctx, c"testmodule", 1, redis.REDISMODULE_APIVER_1) | |
== redis.REDISMODULE_ERR) { | |
return redis.REDISMODULE_ERR; | |
} | |
if (redis.RedisModule_CreateCommand(ctx, c"test.hello", HelloWorld_Command, | |
c"readonly", 0, 0, 0) == redis.REDISMODULE_ERR) { | |
return redis.REDISMODULE_ERR; | |
} | |
return redis.REDISMODULE_OK; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment