Merge branch 'scriptsupport' of git://github.com/ivowiblo/jedis into ivowiblo-scriptsupport
This commit is contained in:
@@ -724,4 +724,46 @@ public class BinaryClient extends Connection {
|
||||
db = 0;
|
||||
super.disconnect();
|
||||
}
|
||||
|
||||
private void sendEvalCommand(Command command, byte[] script, byte[] keyCount, byte[][] params){
|
||||
|
||||
final byte[][] allArgs = new byte[params.length + 2][];
|
||||
|
||||
allArgs[0] = script;
|
||||
allArgs[1] = keyCount;
|
||||
|
||||
for(int i=0;i<params.length; i++)
|
||||
allArgs[i+2] = params[i];
|
||||
|
||||
sendCommand(command, allArgs );
|
||||
}
|
||||
|
||||
public void eval(byte[] script, byte[] keyCount, byte[][] params){
|
||||
sendEvalCommand(EVAL, script, keyCount, params );
|
||||
}
|
||||
|
||||
public void evalsha(byte[] sha1, byte[] keyCount, byte[][] params){
|
||||
sendEvalCommand(EVALSHA, sha1, keyCount, params);
|
||||
}
|
||||
|
||||
public void scriptFlush(){
|
||||
sendCommand(SCRIPT, Keyword.FLUSH.raw);
|
||||
}
|
||||
|
||||
public void scriptExists(byte[]... sha1){
|
||||
byte[][] args = new byte[sha1.length + 1][];
|
||||
args[0] = Keyword.EXISTS.raw;
|
||||
for(int i=0;i<sha1.length; i++)
|
||||
args[i+1] = sha1[i];
|
||||
|
||||
sendCommand(SCRIPT, args);
|
||||
}
|
||||
|
||||
public void scriptLoad(byte[] script){
|
||||
sendCommand(SCRIPT, Keyword.LOAD.raw, script);
|
||||
}
|
||||
|
||||
public void scriptKill(){
|
||||
sendCommand(SCRIPT, Keyword.KILL.raw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user