Apply PF* commands to JedisCluster, ShardedJedis
* Apply PF* commands to JedisCluster, ShardedJedis * PF* commands to interface ** pfadd / pfcount : JedisCommands ** pfmerge : MultiKeyCommands
This commit is contained in:
@@ -3413,7 +3413,7 @@ public class Jedis extends BinaryJedis implements JedisCommands,
|
|||||||
.build(client.getBinaryMultiBulkReply());
|
.build(client.getBinaryMultiBulkReply());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long pfadd(final String key, String... elements) {
|
public Long pfadd(final String key, final String... elements) {
|
||||||
checkIsInMulti();
|
checkIsInMulti();
|
||||||
client.pfadd(key, elements);
|
client.pfadd(key, elements);
|
||||||
return client.getIntegerReply();
|
return client.getIntegerReply();
|
||||||
|
|||||||
@@ -1481,4 +1481,27 @@ public class JedisCluster implements JedisCommands, BasicCommands {
|
|||||||
}
|
}
|
||||||
}.run(null);
|
}.run(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long pfadd(final String key, final String... elements) {
|
||||||
|
return new JedisClusterCommand<Long>(connectionHandler,
|
||||||
|
timeout, maxRedirections) {
|
||||||
|
@Override
|
||||||
|
public Long execute(Jedis connection) {
|
||||||
|
return connection.pfadd(key, elements);
|
||||||
|
}
|
||||||
|
}.run(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long pfcount(final String key) {
|
||||||
|
return new JedisClusterCommand<Long>(connectionHandler,
|
||||||
|
timeout, maxRedirections) {
|
||||||
|
@Override
|
||||||
|
public Long execute(Jedis connection) {
|
||||||
|
return connection.pfcount(key);
|
||||||
|
}
|
||||||
|
}.run(key);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,4 +240,8 @@ public interface JedisCommands {
|
|||||||
ScanResult<String> sscan(final String key, final String cursor);
|
ScanResult<String> sscan(final String key, final String cursor);
|
||||||
|
|
||||||
ScanResult<Tuple> zscan(final String key, final String cursor);
|
ScanResult<Tuple> zscan(final String key, final String cursor);
|
||||||
|
|
||||||
|
Long pfadd(final String key, final String... elements);
|
||||||
|
|
||||||
|
long pfcount(final String key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,4 +79,6 @@ public interface MultiKeyCommands {
|
|||||||
ScanResult<String> scan(int cursor);
|
ScanResult<String> scan(int cursor);
|
||||||
|
|
||||||
ScanResult<String> scan(final String cursor);
|
ScanResult<String> scan(final String cursor);
|
||||||
|
|
||||||
|
String pfmerge(final String destkey, final String... sourcekeys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -570,4 +570,16 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands {
|
|||||||
Jedis j = getShard(key);
|
Jedis j = getShard(key);
|
||||||
return j.zscan(key, cursor);
|
return j.zscan(key, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long pfadd(String key, String... elements) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.pfadd(key, elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long pfcount(String key) {
|
||||||
|
Jedis j = getShard(key);
|
||||||
|
return j.pfcount(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user