redisutil加异常捕捉和日志
parent
e89efa1a76
commit
c2940417ad
|
@ -155,6 +155,7 @@ public class RedisUtil {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void del(String... key) {
|
||||
try {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
|
@ -162,6 +163,9 @@ public class RedisUtil {
|
|||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("redis删除key失败,key:{},error:{}",key,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -195,6 +199,7 @@ public class RedisUtil {
|
|||
* @param key,数组
|
||||
*/
|
||||
public void rename(long time,String postfix,String[] key) {
|
||||
try {
|
||||
if (key != null && key.length > 0) {
|
||||
for (int i = 0; i < key.length; i++) {
|
||||
// 旧名字
|
||||
|
@ -210,7 +215,12 @@ public class RedisUtil {
|
|||
expire(newName,time);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("redis重命名key失败,key:{},error:{}",key,e.getMessage());
|
||||
}
|
||||
del(key);
|
||||
}
|
||||
|
||||
// ============================String=============================
|
||||
|
|
Loading…
Reference in New Issue