Added DEBUG command
This commit is contained in:
@@ -596,4 +596,8 @@ public class Client extends Connection {
|
||||
String value) {
|
||||
sendCommand("LINSERT", key, where.toString(), pivot, value);
|
||||
}
|
||||
|
||||
public void debug(DebugParams params) {
|
||||
sendCommand("DEBUG", params.getCommand());
|
||||
}
|
||||
}
|
||||
43
src/main/java/redis/clients/jedis/DebugParams.java
Normal file
43
src/main/java/redis/clients/jedis/DebugParams.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package redis.clients.jedis;
|
||||
|
||||
public class DebugParams {
|
||||
private String[] command;
|
||||
|
||||
public String[] getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
private DebugParams() {
|
||||
|
||||
}
|
||||
|
||||
public static DebugParams SEGFAULT() {
|
||||
DebugParams debugParams = new DebugParams();
|
||||
debugParams.command = new String[] { "SEGFAULT" };
|
||||
return debugParams;
|
||||
}
|
||||
|
||||
public static DebugParams OBJECT(String key) {
|
||||
DebugParams debugParams = new DebugParams();
|
||||
debugParams.command = new String[] { "OBJECT", key };
|
||||
return debugParams;
|
||||
}
|
||||
|
||||
public static DebugParams SWAPIN(String key) {
|
||||
DebugParams debugParams = new DebugParams();
|
||||
debugParams.command = new String[] { "SWAPIN", key };
|
||||
return debugParams;
|
||||
}
|
||||
|
||||
public static DebugParams RELOAD() {
|
||||
DebugParams debugParams = new DebugParams();
|
||||
debugParams.command = new String[] { "RELOAD" };
|
||||
return debugParams;
|
||||
}
|
||||
|
||||
public static DebugParams SWAPOUT(String key) {
|
||||
DebugParams debugParams = new DebugParams();
|
||||
debugParams.command = new String[] { "SWAPOUT", key };
|
||||
return debugParams;
|
||||
}
|
||||
}
|
||||
@@ -838,4 +838,9 @@ public class Jedis {
|
||||
client.linsert(key, where, pivot, value);
|
||||
return client.getIntegerReply();
|
||||
}
|
||||
|
||||
public String debug(DebugParams params) {
|
||||
client.debug(params);
|
||||
return client.getStatusCodeReply();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import redis.clients.jedis.DebugParams;
|
||||
import redis.clients.jedis.JedisException;
|
||||
import redis.clients.jedis.JedisMonitor;
|
||||
|
||||
@@ -83,4 +84,14 @@ public class ControlCommandsTest extends JedisCommandTestBase {
|
||||
jedis.sync();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void debug() {
|
||||
jedis.set("foo", "bar");
|
||||
String resp = jedis.debug(DebugParams.OBJECT("foo"));
|
||||
assertNotNull(resp);
|
||||
resp = jedis.debug(DebugParams.SWAPIN("foo"));
|
||||
assertNotNull(resp);
|
||||
resp = jedis.debug(DebugParams.RELOAD());
|
||||
assertNotNull(resp);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user