Redis Lua 不识别 Inf?

我正在Redis中编写Lua脚本,并且有一行代码正在导致一切崩溃:

local to_remove = redis.call('ZRANGE', KEYS[1], -5, "+inf")

返回:


redis.exceptions.ResponseError:错误运行脚本(调用f_f1d95d2e103f00220a476f0ef2a2abc798682c55):ERR值不是整数或超出范围

如果我用任何数字替换“+inf”,它会完全消失。 我也尝试过“inf”和“-inf”,但这些都不起作用。 想法?

点赞
用户392975
用户392975
Nevermind. I'm an idiot. Should have just used "-1" in place of "inf." ZRANGE just doesn't support inf, and -1 gives the same results I would have expected from inf. Hopefully this helps someone trying to do the same later on.

不用在意。 我是个白痴。 应该在 "inf" 的位置上使用“ -1”。 ZRANGE 不支持“inf”,而“-1”给出的结果与我期望从“inf”中获得的结果相同。 希望这能帮助后来的某些人尝试相同的事情。

2013-05-22 00:42:13