REDIS

【已解决】在RedisTemplate调用Lua脚本是时候,错误提示:attempt to compare nil with number

在RedisTemplate调用Lua脚本是时候,错误提示:attempttocomparenilwithnumber。如下图:脚本的第14行,使用了tonumber函数,在执行的时候,报错了。说nil不能和number进行比较。分析错误原因:在tonumber函数中其实,是从Redis中获取缓存key为stockKey的值,然后将其转换成数字之后和0进行比较。因为Redis中,目前还没有stoc

在RedisTemplate调用Lua脚本是时候,错误提示:attempt to compare nil with number 。如下图:

f01f64db75b35ef2164b94944056365c.png

脚本的第14行,使用了ton

原创不易,完成人机校验,阅读全文

相关推荐