在使用SpringBoot開發時,使用RedisTemplate執行 redisTemplate.execute(lockScript, redisList);
發現報錯:
ERR Error running script (call to f_8ea1e266485534d17ddba5af05c1b61273c30467): @user_script:10: @user_script: 10: Lua redis() command arguments must be strings or integers .
注意這里的RedisTemplate 使用的是:RedisTemplate<String, Object>
,問題就出在這里,必須使用StringRedisTemplate
這種類型的執行lua腳本才不會報錯
注意:
執行lua腳本 必須使用StringRedisTemplate
類型的,否者報錯!