As in the title, if you are like me, when you call delete in the Controller layer of springboot, you use the StringRedisTemplate to set the key in Redis, and then use the RedisTemplate to call the delete operation to delete the key in Redis, and an empty exception occurs. . What you need to do:
(1) Check which object initiates the set method when you call the stored Key? Do you use RedisTemplate or the set called by StringRedisTemplate.
(2) If it is a set called by StringRedisTemplate, it can only be cleared with delete of StringRedisTemplate.
(3) If you do not use StringRedisTemplate for setkey, but use RedisTemplate for set, then it is very simple, you need to add generics to RedisTemplate.
A pit of the day: After introducing RedisTemplate in SpringBoot, calling the delete method fails? Big pit ratio
Guess you like
Origin blog.csdn.net/qq_44918802/article/details/119907480
Recommended
Ranking