|
|
@ -275,3 +275,19 @@ RedisModuleString **RMUtil_ParseVarArgs(RedisModuleString **argv, int argc, int
|
|
|
|
*nargs = n;
|
|
|
|
*nargs = n;
|
|
|
|
return argv + 1;
|
|
|
|
return argv + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RMUtil_DefaultAofRewrite(RedisModuleIO *aof, RedisModuleString *key, void *value) {
|
|
|
|
|
|
|
|
RedisModuleCtx *ctx = RedisModule_GetThreadSafeContext(NULL);
|
|
|
|
|
|
|
|
RedisModuleCallReply *rep = RedisModule_Call(ctx, "DUMP", "s", key);
|
|
|
|
|
|
|
|
if (rep != NULL && RedisModule_CallReplyType(rep) == REDISMODULE_REPLY_STRING) {
|
|
|
|
|
|
|
|
size_t n;
|
|
|
|
|
|
|
|
const char *s = RedisModule_CallReplyStringPtr(rep, &n);
|
|
|
|
|
|
|
|
RedisModule_EmitAOF(aof, "RESTORE", "slb", key, 0, s, n);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
RedisModule_Log(RedisModule_GetContextFromIO(aof), "warning", "Failed to emit AOF");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rep != NULL) {
|
|
|
|
|
|
|
|
RedisModule_FreeCallReply(rep);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
RedisModule_FreeThreadSafeContext(ctx);
|
|
|
|
|
|
|
|
}
|