车迟斗法缓存问题修改

duhui 2021-01-08 10:16:49 +08:00
parent f6f5a3c60f
commit 3a4bceeaca
1 changed files with 7 additions and 6 deletions

View File

@ -145,13 +145,14 @@ public class RedisUtil {
String oldName = key[i];
// 新名字
String newName = oldName+"BACK:"+System.currentTimeMillis();
// 重命名
if(get(oldName)==null){
continue;
// key是否存在
boolean aBoolean = hasKey(oldName);
if (aBoolean){
// 重命名
redisTemplate.rename(oldName,newName);
// 设置过期时间
expire(newName,60*60*24-60);
}
redisTemplate.rename(oldName,newName);
// 设置过期时间
expire(newName,60*60*24-60);
}
}
}