原文:springboot redis 用RedisTemplate执行lua脚本报错:@user_script:1: ERR value is not an integer or out of range

代码如下: 错误如下: org.springframework.data.redis.RedisSystemException: Error in execution nested exception is io.lettuce.core.RedisCommandExecutionException: ERR Error running script call to f dce e aa a dc ...

2020-06-30 13:55 0 1360 推荐指数:

查看详情

SpringBoot通过RedisTemplate执行Lua脚本

   Redis使用的是内存,内存的速度比磁盘速度肯定要快很多.。使用 Redis实现抢红包,需要知道的是Redis的功能不如数据库强大,事务也不是很完整.因此要保证数据的正确性,可以通过严格的验证得以保证。而 RedisLua 语言是原子性的,且功能更为强大,所以优先选择使用Lua语言来实现 ...

Thu Jun 27 05:11:00 CST 2019 0 2466
执行lua脚本报错ERR 'EVAL' command keys must in same slot.

异常日志 原因分析 测试环境为单机版,线上环境为集群版,导致同样的lua脚本,在线上出错。 lua脚本为保证事务,传入的key必须是在同一个slot中。Redis集群引入了哈希槽的概念,一共有16348个slot,然后根据 CRC16(key) mod 16384 来计算放入哪个slot中 ...

Sat Sep 12 01:01:00 CST 2020 0 571
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM