pipeline 管道同步
public void pipe_jedis(Map<String, String> map) {
try {
ShardedJedisPipeline pipeline = shardedJedis.pipelined();
for(Entry<String, String> entry : map.entrySet()){
pipeline.hset(duilie+"copy", entry.getKey(), entry.getValue());
}
pipeline.sync();
} catch (Exception e) {
logger.error("isRepeat"+e.getMessage());
RedisUtils.closeShardedJedis(shardedJedis);
shardedJedis = initShardedJedis(redisip, redisport, 0,redisPassword);
ShardedJedisPipeline pipeline = shardedJedis.pipelined();
for(Entry<String, String> entry : map.entrySet()){
pipeline.hset(duilie+"copy", entry.getKey(), entry.getValue());
}
pipeline.sync();
}
}
public static void main(String[] args) {
BaseCollect bCollect = new BaseCollect();
WeMediaSearch wSearch = new WeMediaSearch();
Map<String, String> list = bCollect.hgetAll(duilie);
System.out.println(DateFormatUtil.getCurrentTime());
wSearch.pipe_jedis(list);
System.out.println(DateFormatUtil.getCurrentTime());
}