从7.x版本开始,Redis就引入了函数,作为脚本执行的替代方法,如文档所示的这里。
我正在寻找一个例子,或文档如何使用红色功能使用围棋包。不确定,go-redis是否支持此功能。
谢谢你让我知道这件事。
发布于 2022-10-24 08:33:16
我在go-redis的正式文档中搜索了更多内容,它有一种使用Do执行不受支持的命令的方法,正如前面提到的这里。
// Defind the function code..
fcode := `#!lua name=mylib
redis.register_function('myfunc',
function (keys, args)
return args[1]
end)`
// Load or replace the function
val, err := rdb.Do(ctx, "function", "load", "replace", "<function code text>").Result()
// later in the code... call the function
va, err := rdb.Do(ctx, "fcall", "myfunc", 0, "hello").Result()https://stackoverflow.com/questions/74178169
复制相似问题