diff --git a/pom.xml b/pom.xml index d6fe30b30..33c9ef2eb 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 1.4.8 2.6.0 5.1.6.RELEASE - 3.0.1 + 3.1.0 1.01 4.1.22.Final spring.data.redis diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java index 19facef9e..6003fa504 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisZSetCommands.java @@ -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); + } } /*