Merge branch 'reset-state-of-jedis-client' of github.com:HeartSaVioR/jedis into HeartSaVioR-reset-state-of-jedis-client
This commit is contained in:
@@ -29,15 +29,21 @@ public class BinaryClient extends Connection {
|
||||
}
|
||||
|
||||
private boolean isInMulti;
|
||||
|
||||
|
||||
private String password;
|
||||
|
||||
private long db;
|
||||
|
||||
private boolean isInWatch;
|
||||
|
||||
public boolean isInMulti() {
|
||||
return isInMulti;
|
||||
}
|
||||
|
||||
public boolean isInWatch() {
|
||||
return isInWatch;
|
||||
}
|
||||
|
||||
public BinaryClient(final String host) {
|
||||
super(host);
|
||||
}
|
||||
@@ -446,19 +452,23 @@ public class BinaryClient extends Connection {
|
||||
public void discard() {
|
||||
sendCommand(DISCARD);
|
||||
isInMulti = false;
|
||||
isInWatch = false;
|
||||
}
|
||||
|
||||
public void exec() {
|
||||
sendCommand(EXEC);
|
||||
isInMulti = false;
|
||||
isInWatch = false;
|
||||
}
|
||||
|
||||
public void watch(final byte[]... keys) {
|
||||
sendCommand(WATCH, keys);
|
||||
isInWatch = true;
|
||||
}
|
||||
|
||||
public void unwatch() {
|
||||
sendCommand(UNWATCH);
|
||||
isInWatch = false;
|
||||
}
|
||||
|
||||
public void sort(final byte[] key) {
|
||||
@@ -911,6 +921,14 @@ public class BinaryClient extends Connection {
|
||||
db = 0;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
public void resetState() {
|
||||
if (isInMulti())
|
||||
discard();
|
||||
|
||||
if (isInWatch())
|
||||
unwatch();
|
||||
}
|
||||
|
||||
private void sendEvalCommand(Command command, byte[] script,
|
||||
byte[] keyCount, byte[][] params) {
|
||||
|
||||
Reference in New Issue
Block a user