Skip to content

Commit 18c8622

Browse files
committed
DATAREDIS-1015 - Upgrade to Jedis 3.1.0.
Add pipelining/transactional implementation for zcount.
1 parent e2f65c6 commit 18c8622

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<xstream>1.4.8</xstream>
2323
<pool>2.6.0</pool>
2424
<lettuce>5.1.6.RELEASE</lettuce>
25-
<jedis>3.0.1</jedis>
25+
<jedis>3.1.0</jedis>
2626
<multithreadedtc>1.01</multithreadedtc>
2727
<netty>4.1.22.Final</netty>
2828
<java-module-name>spring.data.redis</java-module-name>

src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,16 +466,24 @@ public Long zCount(byte[] key, double min, double max) {
466466
public Long zCount(byte[] key, Range range) {
467467

468468
Assert.notNull(key, "Key must not be null!");
469+
Assert.notNull(range, "Range must not be null!");
469470

470-
if (isPipelined() || isQueueing()) {
471-
throw new UnsupportedOperationException(
472-
"ZCOUNT not implemented in jedis for binary protocol on transaction and pipeline");
473-
}
474-
475-
// TODO: Implement zcount for pipeline/tx.
476471
byte[] min = JedisConverters.boundaryToBytesForZRange(range.getMin(), JedisConverters.NEGATIVE_INFINITY_BYTES);
477472
byte[] max = JedisConverters.boundaryToBytesForZRange(range.getMax(), JedisConverters.POSITIVE_INFINITY_BYTES);
478-
return connection.getJedis().zcount(key, min, max);
473+
474+
try {
475+
if (isPipelined()) {
476+
pipeline(connection.newJedisResult(connection.getRequiredPipeline().zcount(key, min, max)));
477+
return null;
478+
}
479+
if (isQueueing()) {
480+
transaction(connection.newJedisResult(connection.getRequiredTransaction().zcount(key, min, max)));
481+
return null;
482+
}
483+
return connection.getJedis().zcount(key, min, max);
484+
} catch (Exception ex) {
485+
throw convertJedisAccessException(ex);
486+
}
479487
}
480488

481489
/*

0 commit comments

Comments
 (0)