Stop a timer, returns REDISMODULE_OK if the timer was found, belonged to the * calling module, and was stopped, otherwise REDISMODULE_ERR is returned. * If not NULL, the data pointer is set to the value of the data argument when * the timer was created. */
| 6380 | * If not NULL, the data pointer is set to the value of the data argument when |
| 6381 | * the timer was created. */ |
| 6382 | int RM_StopTimer(RedisModuleCtx *ctx, RedisModuleTimerID id, void **data) { |
| 6383 | RedisModuleTimer *timer = raxFind(Timers,(unsigned char*)&id,sizeof(id)); |
| 6384 | if (timer == raxNotFound || timer->module != ctx->module) |
| 6385 | return REDISMODULE_ERR; |
| 6386 | if (data) *data = timer->data; |
| 6387 | raxRemove(Timers,(unsigned char*)&id,sizeof(id),NULL); |
| 6388 | zfree(timer); |
| 6389 | return REDISMODULE_OK; |
| 6390 | } |
| 6391 | |
| 6392 | /* Obtain information about a timer: its remaining time before firing |
| 6393 | * (in milliseconds), and the private data pointer associated with the timer. |