2024-03-22 21:25:55.465 ERROR 23340 — [nio-8081-exec-5] com.hmdp.config.WebExceptionAdvice : 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
——这是由于刚开始为了实现”一人一赞“这个功能使用了set这个redis结构,之后希望在点进博客之后该博客的点赞记录按照时间顺序排列,用到了zset这个redis数据结构。
原因
如果刚开始在斜线部分完成后点击了一个博客A,之后完成粗体部分功能后继续点击相同的博客,就会出现上面的情况,因为redis当中还存放着斜体部分的set数据。(这两部分在redis中使用的是相同的key)