Nortyr commented on code in PR #13238:
URL: https://github.com/apache/dubbo/pull/13238#discussion_r1369995013


##########
dubbo-metadata/dubbo-metadata-report-redis/src/main/java/org/apache/dubbo/metadata/store/redis/RedisMetadataReport.java:
##########
@@ -61,12 +77,34 @@ public class RedisMetadataReport extends 
AbstractMetadataReport {
     private Set<HostAndPort> jedisClusterNodes;
     private int timeout;
     private String password;
+    private final String root;
+    private MD5Utils md5Utils = new MD5Utils();
+    protected ConcurrentMap<String, MappingDataListener> listenerMap = new 
ConcurrentHashMap<>();
+    private String luaScript="local key = KEYS[1];\n" +
+        "local field = ARGV[1];\n" +
+        "local oldValue = ARGV[2];\n" +
+        "local newValue = ARGV[3];\n" +
+        "local channel = ARGV[4];\n" +
+        "local valueExists = redis.call(\"HEXISTS\", key, field);\n" +
+        "if valueExists == 0 then\n" +
+        "    redis.call(\"HSET\", key, field, newValue);\n" +

Review Comment:
   请问下JedisCluster中无法使用watch有什么好的建议呢?
   如果不建议使用lua脚本的话,要不然使用setnx实现一个简易的锁?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to