车迟斗法缓存问题修改

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