Linchen-Xu commented on code in PR #13238:
URL: https://github.com/apache/dubbo/pull/13238#discussion_r1368348587


##########
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:
   Starting from version 2.2, redis provides `WATCH` to help implement [cas 
behavior](https://redis.io/docs/interact/transactions/#cas) in case race 
conditions may occur.



-- 
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: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to