I use Spring RedisTemplate , this is my code :
for (int i = 0; i < 10000; i++) {
redisTemplate.execute(
connection -> {
Long del = connection.del(new StringRedisSerializer().serialize(name));
if (del == null) {
log.info("delete lock - error , count {} , del : {} ", PlatformApplication.THREAD_LOCAL.get(), del);
}
Long aLong = redisTemplate.opsForValue().get(name);
if (aLong != null) {
log.info("delete lock - error name : {} , value : {} ,count : {} ,del : {} ", name, aLong, PlatformApplication.THREAD_LOCAL.get(), del);
}
return null;
}, true);
}
but sometime , I can get key what I deleted。
2020-08-06 19:58:37.811 INFO 83489 --- [ main] c.d.p.c.runtime.RedisLockSupplierImpl : delete lock - error name : .sdk.DefaultPlatformNameGenerator.123213213 , value : 1596715127810 ,count : 1414 ,del : 1
I hava only one redis。
Comment From: itamarhaber
Hello @shenjianeng
I'm guessing that the key was created after your code deleted it, perhaps by another process?
In any case, please keep in mind that this issue tracker should be used for reporting bugs or proposing improvements to the Redis server. Your issue appears to be related Spring, so perhaps you should investigate it there and kindly close this one.
Comment From: shenjianeng
this key is just being used by me。
Now I use this URL as my key
2020-08-06 20:32:13.623 INFO 83856 --- [ main] c.d.p.c.runtime.RedisLockSupplierImpl : delete lock - error name : .sdk.DefaultPlatformNameGenerator.https://github.com/redis/redis/issues/7619 , value : 1596717143622 ,count : 154 ,del : 1
Comment From: shenjianeng
sorry 。 this is my code bug