Reply with an array type of 'len' elements. However 'len' other calls * to `ReplyWith*` style functions must follow in order to emit the elements * of the array. * * When producing arrays with a number of element that is not known beforehand * the function can be called with the special count * REDISMODULE_POSTPONED_ARRAY_LEN, and the actual number of elements can be * later set with RedisM
| 1547 | * |
| 1548 | * The function always returns REDISMODULE_OK. */ |
| 1549 | int RM_ReplyWithArray(RedisModuleCtx *ctx, long len) { |
| 1550 | client *c = moduleGetReplyClient(ctx); |
| 1551 | if (c == NULL) return REDISMODULE_OK; |
| 1552 | if (len == REDISMODULE_POSTPONED_ARRAY_LEN) { |
| 1553 | ctx->postponed_arrays = zrealloc(ctx->postponed_arrays,sizeof(void*)* |
| 1554 | (ctx->postponed_arrays_count+1)); |
| 1555 | ctx->postponed_arrays[ctx->postponed_arrays_count] = |
| 1556 | addReplyDeferredLen(c); |
| 1557 | ctx->postponed_arrays_count++; |
| 1558 | } else { |
| 1559 | addReplyArrayLen(c,len); |
| 1560 | } |
| 1561 | return REDISMODULE_OK; |
| 1562 | } |
| 1563 | |
| 1564 | /* Reply to the client with a null array, simply null in RESP3 |
| 1565 | * null array in RESP2. |
nothing calls this directly
no test coverage detected