diff --git a/java/client/src/main/java/glide/api/BaseClient.java b/java/client/src/main/java/glide/api/BaseClient.java
index 8ad5a4ba55..20360ab13d 100644
--- a/java/client/src/main/java/glide/api/BaseClient.java
+++ b/java/client/src/main/java/glide/api/BaseClient.java
@@ -2,7 +2,11 @@
package glide.api;
import static glide.ffi.resolvers.SocketListenerResolver.getSocket;
+import static glide.utils.ArrayTransformUtils.castArray;
+import static glide.utils.ArrayTransformUtils.convertMapToArgArray;
import static redis_request.RedisRequestOuterClass.RequestType.GetString;
+import static redis_request.RedisRequestOuterClass.RequestType.MGet;
+import static redis_request.RedisRequestOuterClass.RequestType.MSet;
import static redis_request.RedisRequestOuterClass.RequestType.Ping;
import static redis_request.RedisRequestOuterClass.RequestType.SAdd;
import static redis_request.RedisRequestOuterClass.RequestType.SCard;
@@ -157,13 +161,17 @@ protected Long handleLongResponse(Response response) throws RedisException {
}
protected Object[] handleArrayResponse(Response response) throws RedisException {
+ return handleRedisResponse(Object[].class, false, response);
+ }
+
+ protected Object[] handleArrayOrNullResponse(Response response) throws RedisException {
return handleRedisResponse(Object[].class, true, response);
}
/**
* @param response A Protobuf response
* @return A map of String
to V
- * @param Value type, could be even map too
+ * @param Value type could be even map too
*/
@SuppressWarnings("unchecked") // raw Map cast to Map
protected Map handleMapResponse(Response response) throws RedisException {
@@ -204,6 +212,18 @@ public CompletableFuture set(
return commandManager.submitNewCommand(SetString, arguments, this::handleStringOrNullResponse);
}
+ @Override
+ public CompletableFuture mget(@NonNull String[] keys) {
+ return commandManager.submitNewCommand(
+ MGet, keys, response -> castArray(handleArrayOrNullResponse(response), String.class));
+ }
+
+ @Override
+ public CompletableFuture mset(@NonNull Map keyValueMap) {
+ String[] args = convertMapToArgArray(keyValueMap);
+ return commandManager.submitNewCommand(MSet, args, this::handleStringResponse);
+ }
+
@Override
public CompletableFuture sadd(String key, String[] members) {
String[] arguments = ArrayUtils.addFirst(members, key);
diff --git a/java/client/src/main/java/glide/api/RedisClient.java b/java/client/src/main/java/glide/api/RedisClient.java
index c6dd4e10d4..94af58bd42 100644
--- a/java/client/src/main/java/glide/api/RedisClient.java
+++ b/java/client/src/main/java/glide/api/RedisClient.java
@@ -42,7 +42,7 @@ public CompletableFuture