summaryrefslogtreecommitdiff
path: root/src/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/module.c')
-rw-r--r--src/module.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index e69d3dc61..e1ffd7313 100644
--- a/src/module.c
+++ b/src/module.c
@@ -3438,6 +3438,14 @@ RedisModuleCtx *RM_GetContextFromIO(RedisModuleIO *io) {
return io->ctx;
}
+/* Returns a RedisModuleString with the name of the key currently saving or
+ * loading, when an IO data type callback is called. There is no guarantee
+ * that the key name is always available, so this may return NULL.
+ */
+const RedisModuleString *RM_GetKeyNameFromIO(RedisModuleIO *io) {
+ return io->key;
+}
+
/* --------------------------------------------------------------------------
* Logging
* -------------------------------------------------------------------------- */
@@ -5164,6 +5172,7 @@ void moduleRegisterCoreAPI(void) {
REGISTER_API(RetainString);
REGISTER_API(StringCompare);
REGISTER_API(GetContextFromIO);
+ REGISTER_API(GetKeyNameFromIO);
REGISTER_API(BlockClient);
REGISTER_API(UnblockClient);
REGISTER_API(IsBlockedReplyRequest);