mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Modules API: fix timer example.
This commit is contained in:
parent
4e53624052
commit
005c932f22
@ -30,6 +30,7 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define REDISMODULE_EXPERIMENTAL_API
|
||||||
#include "../redismodule.h"
|
#include "../redismodule.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -41,6 +42,7 @@
|
|||||||
|
|
||||||
/* Timer callback. */
|
/* Timer callback. */
|
||||||
void timerHandler(RedisModuleCtx *ctx, void *data) {
|
void timerHandler(RedisModuleCtx *ctx, void *data) {
|
||||||
|
REDISMODULE_NOT_USED(ctx);
|
||||||
printf("Fired %s!\n", data);
|
printf("Fired %s!\n", data);
|
||||||
RedisModule_Free(data);
|
RedisModule_Free(data);
|
||||||
}
|
}
|
||||||
@ -55,6 +57,7 @@ int TimerCommand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
|
|||||||
char *buf = RedisModule_Alloc(256);
|
char *buf = RedisModule_Alloc(256);
|
||||||
snprintf(buf,256,"After %d", delay);
|
snprintf(buf,256,"After %d", delay);
|
||||||
RedisModuleTimerID tid = RedisModule_CreateTimer(ctx,delay,timerHandler,buf);
|
RedisModuleTimerID tid = RedisModule_CreateTimer(ctx,delay,timerHandler,buf);
|
||||||
|
REDISMODULE_NOT_USED(tid);
|
||||||
}
|
}
|
||||||
return RedisModule_ReplyWithSimpleString(ctx, "OK");
|
return RedisModule_ReplyWithSimpleString(ctx, "OK");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user