添加注释

This commit is contained in:
renkaige
2018-12-02 17:20:34 +06:00
parent 6b7dfefde2
commit 6e2d8bf02f

View File

@@ -87,6 +87,7 @@ public class SyncRedisToCluster {
} }
} }
// 删除之前的key
public void deleteRedisKeyStartWith(String redisKeyStartWith) { public void deleteRedisKeyStartWith(String redisKeyStartWith) {
try { try {
Map<String, JedisPool> clusterNodes = jedisCluster.getClusterNodes(); Map<String, JedisPool> clusterNodes = jedisCluster.getClusterNodes();
@@ -189,6 +190,7 @@ public class SyncRedisToCluster {
} }
min = Double.parseDouble(start + ""); min = Double.parseDouble(start + "");
max = Double.parseDouble(end + ""); max = Double.parseDouble(end + "");
//分批获取,避免一次性获取太多,造成redis阻塞
zrangeByScoreWithScores = resource.zrangeByScoreWithScores("MAAT_UPDATE_STATUS", min, max);// 获取所有的maat_update_status zrangeByScoreWithScores = resource.zrangeByScoreWithScores("MAAT_UPDATE_STATUS", min, max);// 获取所有的maat_update_status
syncData(zrangeByScoreWithScores); syncData(zrangeByScoreWithScores);
} }
@@ -264,6 +266,13 @@ public class SyncRedisToCluster {
return false; return false;
} }
/**
* 利用scan模糊匹配key
*
* @param pattern
* @param resource
* @return
*/
public List<String> getKeyByScan(String pattern, Jedis resource) { public List<String> getKeyByScan(String pattern, Jedis resource) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
int count = 1000; int count = 1000;