【问题标题】:ioredis (nodejs): Debugging custom command with lua scriptioredis (nodejs):使用 lua 脚本调试自定义命令
【发布时间】:2018-01-24 21:43:11
【问题描述】:

我编写了一个自定义 lua 脚本,以便我可以在我的节点进程中从 ioredis 运行它:

REDIS_CLIENT.defineCommand('my_command', {
            lua: fs.readFileSync(path.resolve(__dirname, './lua_scripts/my_command.lua'), {
                encoding: 'utf8'
            })
        });

我想在我的my_commands.lua 中添加打印,所以当我运行client.my_command(args) 时,它将被打印到nodejs 进程stdout 但是当我添加print "hello lua" 时它没有(这是有道理的)。

有没有办法将 lua 自定义脚本中的内容打印到我的 nodejs 进程标准输出中?

【问题讨论】:

    标签: node.js redis ioredis


    【解决方案1】:

    没有直接的方法可以做到这一点,但是我描述了here 的一些间接方法。其中,除了新的 v3.2 集成 Lua debuggerZerobrane Studio plugin 之外,追踪 IMO 最有用和最简单的方法是使用 PubSub 或 ECHOMONITOR

    【讨论】:

    • 非常有用。 תודה。
    • התענוג כולו שלי 并随时问我有关 Redis 的任何问题
    猜你喜欢
    • 2019-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-17
    • 1970-01-01
    • 1970-01-01
    • 2021-10-30
    • 1970-01-01
    相关资源
    最近更新 更多