jdeppe-pivotal commented on a change in pull request #6862:
URL: https://github.com/apache/geode/pull/6862#discussion_r713038275
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisStringCommandsFunctionExecutor.java
##########
@@ -144,6 +143,26 @@ public int setbit(RedisKey key, long offset, int value) {
() -> getRedisString(key, false).setbit(getRegion(), key, value,
byteIndex, bitIndex));
}
+ @Override
+ public Void mset(List<RedisKey> keys, List<byte[]> values) {
+ List<RedisKey> keysToLock = new ArrayList<>(keys.size());
+ for (RedisKey key : keys) {
+ getRegionProvider().ensureKeyIsLocal(key);
+ keysToLock.add(key);
+ }
+
+ // Pass a key in so that the bucket will be locked. Since all keys are
already guaranteed to be
+ // in the same bucket we can use any key for this.
+ return stripedExecuteInTransaction(keysToLock.get(0), keysToLock, () ->
mset0(keys, values));
+ }
+
+ private Void mset0(List<RedisKey> keys, List<byte[]> values) {
+ for (int i = 0; i < keys.size(); i++) {
+ setRedisString(getRegionProvider(), keys.get(i), values.get(i));
Review comment:
Yes! Good call.
--
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]