当前位置:网站首页>RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value

RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value

2022-07-06 18:41:00 Monkey who loves life

One 、 Error message

I reported this error when deleting the cache :WRONGTYPE Operation against a key holding the wrong kind of value

Two 、 Wrong meaning

Wrong type operation for the key holding the wrong type value  

  3、 ... and 、 The cause of the error

When I save the cache, I use zset structure :

          redisTemplate.opsForSet().add(key,value);

But when I delete this cache, I use :

          redisTemplate.opsForZSet().remove(key,value);

Therefore, data structure inconsistency leads to , Error when deleting .

Four 、 terms of settlement

  When deleting the cache structure, change to Set:

 redisTemplate.opsForSet().remove(key,value);

Keep the same structure when saving and deleting .

This is the problem I encountered in my actual work , I hope it helps you ~ 

原网站

版权声明
本文为[Monkey who loves life]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061044044102.html