Linchen-Xu commented on code in PR #13238:
URL: https://github.com/apache/dubbo/pull/13238#discussion_r1370026407
##########
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:
之前有人[讨论](https://groups.google.com/g/jedis_redis/c/Z4-0065UFkg)过在JedisCluster上如何做transaction,基本思路是从sluter里拿到对应key所在的Jedis,然后在上面开transaction,只不过这样做的话会稍微麻烦点。
我觉得用什么方式都无所谓,只要能实现目标就行。
##########
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:
之前有人[讨论](https://groups.google.com/g/jedis_redis/c/Z4-0065UFkg)过在JedisCluster上如何做transaction,基本思路是从sluter里拿到对应key所在的Jedis,然后在上面开transaction,只不过这样做的话会稍微麻烦点。
我觉得用什么方式都无所谓,只要能实现目标就行。
--
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]