详细报错信息如下

org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: WRONGTYPE Operation against a key holding the wrong kind of value

这个主要是因为我的redis中的存放的类型和后面取出时候接受的类型不匹配的问题
具体的错误代码是
取出的类型

Double score = stringRedisTemplate.opsForZSet().score(key, userId.toString());

存放的类型

stringRedisTemplate.opsForZSet().add(key,userId.toString(),
System.currentTimeMillis()
);

我这里存储的是时间戳但是返回的数据类型是double所以导致错误接受

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐