...
|
...
|
@@ -326,6 +326,7 @@ public class RedisCommonUtil { |
|
|
* redis 清除缓存 ,根据前缀
|
|
|
*/
|
|
|
public static Long removeRedisKeyByPrefix(String host,int port,String prefix){
|
|
|
logger.info("removeRedisKeyByPrefix begin {},{},{} ",host ,port ,prefix);
|
|
|
Long total=0L;
|
|
|
if(StringUtils.isBlank(prefix)){
|
|
|
return total;
|
...
|
...
|
@@ -351,7 +352,9 @@ public class RedisCommonUtil { |
|
|
}
|
|
|
}
|
|
|
|
|
|
nextCursor=new String(sr.getCursorAsBytes(),"UTF-8");
|
|
|
//nextCursor=new String(sr.getCursorAsBytes(),"UTF-8");
|
|
|
nextCursor=sr.getStringCursor();
|
|
|
logger.info("removeRedisKeyByPrefix nextCursor {}",nextCursor);
|
|
|
}while (!nextCursor.equals("0"));
|
|
|
|
|
|
//删除
|
...
|
...
|
@@ -363,7 +366,7 @@ public class RedisCommonUtil { |
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.toString());
|
|
|
logger.error("removeRedisKeyByPrefix error {}",e);
|
|
|
}finally {
|
|
|
if(client!=null){
|
|
|
client.close();
|
...
|
...
|
|