Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing args to MODULE LOAD #2918

Merged
merged 6 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -8798,6 +8798,13 @@ public String moduleLoad(final String path) {
return connection.getStatusCodeReply();
}

@Override
public String moduleLoad(String path, String... args) {
checkIsInMultiOrPipeline();
connection.sendCommand(MODULE, joinParameters(LOAD.name(), path, args));
return connection.getStatusCodeReply();
}

@Override
public String moduleUnload(final String name) {
checkIsInMultiOrPipeline();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public class Module {

private String name;
private int version;
private final String name;
private final int version;

public Module(String name, int version) {
this.name = name;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/redis/clients/jedis/commands/ModuleCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,32 @@

public interface ModuleCommands {

/**
* Load and initialize the Redis module from the dynamic library specified by the path argument.
* @param path should be the absolute path of the library, including the full filename
* @return OK
*/
String moduleLoad(String path);

/**
* Load and initialize the Redis module from the dynamic library specified by the path argument.
* @param path should be the absolute path of the library, including the full filename
* @param args additional arguments are passed unmodified to the module
* @return OK
*/
String moduleLoad(String path, String... args);
Avital-Fine marked this conversation as resolved.
Show resolved Hide resolved

/**
* Unload the module specified by name. Note that the module's name is reported by the
* {@link ModuleCommands#moduleList() MODULE LIST} command, and may differ from the dynamic library's filename.
* @param name
* @return OK
*/
String moduleUnload(String name);

/**
* Return information about the modules loaded to the server.
* @return list of {@link Module}
*/
List<Module> moduleList();
}