diff --git a/src/com/zdemo/cachex/RedisTest.java b/src/com/zdemo/cachex/RedisTest.java index 669529b..04cf9ed 100644 --- a/src/com/zdemo/cachex/RedisTest.java +++ b/src/com/zdemo/cachex/RedisTest.java @@ -3,8 +3,6 @@ package com.zdemo.cachex; import org.redkale.convert.json.JsonFactory; import org.redkale.util.AnyValue; -import java.util.Map; - public class RedisTest { static MyRedisCacheSource source = new MyRedisCacheSource(); @@ -115,9 +113,14 @@ public class RedisTest { System.out.println(source.getCollectionSize("sk")); // 2*/ - Map hms = source.getHms("supportusers", "5-kfeu0f", "xxxx", "3-0kbt7u8t", "95q- "); + /*Map hms = source.getHms("supportusers", "5-kfeu0f", "xxxx", "3-0kbt7u8t", "95q- "); hms.forEach((k, v) -> { System.out.println(k + " : " + v); + });*/ + + source.queryKeysStartsWith("ywb:").forEach(x -> { + System.out.println(x); + source.remove(x); }); diff --git a/src/com/zdemo/zhub/ZHubClient.java b/src/com/zdemo/zhub/ZHubClient.java index a86b606..f48c867 100644 --- a/src/com/zdemo/zhub/ZHubClient.java +++ b/src/com/zdemo/zhub/ZHubClient.java @@ -30,7 +30,6 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer private String auth = ""; private String groupid = ""; - //private ReentrantLock lock = new ReentrantLock(); private Socket client; private OutputStream writer; private BufferedReader reader; @@ -41,16 +40,21 @@ public class ZHubClient extends AbstractConsumer implements IConsumer, IProducer private final LinkedBlockingQueue> rpcCallQueue = new LinkedBlockingQueue<>(); // RPC CALL MSG private final LinkedBlockingQueue sendMsgQueue = new LinkedBlockingQueue<>(); // SEND MSG - /*private BiConsumer threadBuilder = (r, n) -> { - for (int i = 0; i < n; i++) { - new Thread(() -> r.run()).start(); - } - };*/ - - /*private static boolean isFirst = true; - private boolean isMain = false;*/ private static Map mainHub = new HashMap<>(); // 127.0.0.1:1216 - ZHubClient + public ZHubClient() { + + } + + public ZHubClient(String name, Map attr) { + this.APP_NAME = name; + this.addr = attr.get("addr"); + this.groupid = attr.get("groupid"); + this.auth = attr.get("auth"); + + this.init(null); + } + @Override public void init(AnyValue config) { if (!preInit()) {