Apply PF* (string, binary) commands to Pipeline

* Apply PF* (string, binary) commands to Pipeline
* PF* Pipeline (string, binary) commands to interface
** pfadd / pfcount : BinaryRedisPipeline, RedisPipeline
** pfmerge : MultiKeyBinaryRedisPipeline, MultiKeyCommandsPipeline
This commit is contained in:
Jungtaek Lim
2014-04-05 23:48:49 +09:00
parent 11f05ec161
commit c2cf79c972
9 changed files with 51 additions and 4 deletions

View File

@@ -1261,7 +1261,7 @@ public class BinaryClient extends Connection {
public void pfcount(final byte[] key) {
sendCommand(PFCOUNT, key);
}
public void pfmerge(final byte[] deskey, final byte[]... sourcekeys) {
sendCommand(PFMERGE, joinParameters(deskey, sourcekeys));
public void pfmerge(final byte[] destkey, final byte[]... sourcekeys) {
sendCommand(PFMERGE, joinParameters(destkey, sourcekeys));
}
}

View File

@@ -210,4 +210,8 @@ public interface BinaryRedisPipeline {
Response<Long> bitcount(byte[] key);
Response<Long> bitcount(byte[] key, long start, long end);
Response<Long> pfadd(final byte[] key, final byte[]... elements);
Response<Long> pfcount(final byte[] key);
}

View File

@@ -4,7 +4,6 @@ import redis.clients.jedis.exceptions.JedisAskDataException;
import redis.clients.jedis.exceptions.JedisClusterException;
import redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisException;
import redis.clients.jedis.exceptions.JedisMovedDataException;
import redis.clients.jedis.exceptions.JedisRedirectionException;
import redis.clients.util.JedisClusterCRC16;

View File

@@ -65,4 +65,6 @@ public interface MultiKeyBinaryRedisPipeline {
Response<byte[]> randomKeyBinary();
Response<Long> bitop(BitOP op, final byte[] destKey, byte[]... srcKeys);
Response<String> pfmerge(final byte[] destkey, final byte[]... sourcekeys);
}

View File

@@ -64,4 +64,6 @@ public interface MultiKeyCommandsPipeline {
Response<String> randomKey();
Response<Long> bitop(BitOP op, final String destKey, String... srcKeys);
Response<String> pfmerge(final String destkey, final String... sourcekeys);
}

View File

@@ -446,4 +446,16 @@ abstract class MultiKeyPipelineBase extends PipelineBase implements
client.clusterSetSlotImporting(slot, nodeId);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> pfmerge(byte[] destkey, byte[]... sourcekeys) {
client.pfmerge(destkey, sourcekeys);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> pfmerge(String destkey, String... sourcekeys) {
client.pfmerge(destkey, sourcekeys);
return getResponse(BuilderFactory.STRING);
}
}

View File

@@ -124,5 +124,5 @@ public class Pipeline extends MultiKeyPipelineBase {
currentMulti = new MultiResponseBuilder();
return response;
}
}

View File

@@ -1204,4 +1204,28 @@ abstract class PipelineBase extends Queable implements BinaryRedisPipeline,
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> pfadd(byte[] key, byte[]... elements) {
getClient(key).pfadd(key, elements);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> pfcount(byte[] key) {
getClient(key).pfcount(key);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> pfadd(String key, String... elements) {
getClient(key).pfadd(key, elements);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> pfcount(String key) {
getClient(key).pfcount(key);
return getResponse(BuilderFactory.LONG);
}
}

View File

@@ -188,4 +188,8 @@ public interface RedisPipeline {
Response<Long> bitcount(String key);
Response<Long> bitcount(String key, long start, long end);
Response<Long> pfadd(final String key, final String... elements);
Response<Long> pfcount(final String key);
}