HELLO.KEYS -- Return all the keys in the current database without blocking * the server. The keys do not represent a point-in-time state so only the keys * that were in the database from the start to the end are guaranteed to be * there. */
| 179 | * that were in the database from the start to the end are guaranteed to be |
| 180 | * there. */ |
| 181 | int HelloKeys_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) { |
| 182 | REDISMODULE_NOT_USED(argv); |
| 183 | if (argc != 1) return RedisModule_WrongArity(ctx); |
| 184 | |
| 185 | pthread_t tid; |
| 186 | |
| 187 | /* Note that when blocking the client we do not set any callback: no |
| 188 | * timeout is possible since we passed '0', nor we need a reply callback |
| 189 | * because we'll use the thread safe context to accumulate a reply. */ |
| 190 | RedisModuleBlockedClient *bc = RedisModule_BlockClient(ctx,NULL,NULL,NULL,0); |
| 191 | |
| 192 | /* Now that we setup a blocking client, we need to pass the control |
| 193 | * to the thread. However we need to pass arguments to the thread: |
| 194 | * the reference to the blocked client handle. */ |
| 195 | if (pthread_create(&tid,NULL,HelloKeys_ThreadMain,bc) != 0) { |
| 196 | RedisModule_AbortBlock(bc); |
| 197 | return RedisModule_ReplyWithError(ctx,"-ERR Can't start thread"); |
| 198 | } |
| 199 | return REDISMODULE_OK; |
| 200 | } |
| 201 | |
| 202 | /* This function must be present on each Redis module. It is used in order to |
| 203 | * register the commands into the Redis server. */ |
nothing calls this directly
no test coverage detected