DATAREDIS-1015 - Upgrade to Jedis 3.1.0.

Add pipelining/transactional implementation for zcount.
This commit is contained in:
Mark Paluch
2019-07-24 12:04:48 +02:00
parent e2f65c6c37
commit 18c862210c
2 changed files with 16 additions and 8 deletions

View File

@@ -466,16 +466,24 @@ class JedisZSetCommands implements RedisZSetCommands {
public Long zCount(byte[] key, Range range) {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(range, "Range must not be null!");
if (isPipelined() || isQueueing()) {
throw new UnsupportedOperationException(
"ZCOUNT not implemented in jedis for binary protocol on transaction and pipeline");
}
// TODO: Implement zcount for pipeline/tx.
byte[] min = JedisConverters.boundaryToBytesForZRange(range.getMin(), JedisConverters.NEGATIVE_INFINITY_BYTES);
byte[] max = JedisConverters.boundaryToBytesForZRange(range.getMax(), JedisConverters.POSITIVE_INFINITY_BYTES);
return connection.getJedis().zcount(key, min, max);
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().zcount(key, min, max)));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().zcount(key, min, max)));
return null;
}
return connection.getJedis().zcount(key, min, max);
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
/*