
WRONGTYPE Operation against a key holding the wrong kind of value--redis类型转化报错
这个主要是因为我的redis中的存放的类型和后面取出时候接受的类型不匹配的问题。我这里存储的是时间戳但是返回的数据类型是double所以导致错误接受。
·
详细报错信息如下
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所以导致错误接受
更多推荐
所有评论(0)