diff --git a/src/main/java/org/redisson/RedissonScoredSortedSet.java b/src/main/java/org/redisson/RedissonScoredSortedSet.java index 92ef84920..106d4e16c 100644 --- a/src/main/java/org/redisson/RedissonScoredSortedSet.java +++ b/src/main/java/org/redisson/RedissonScoredSortedSet.java @@ -313,6 +313,30 @@ public class RedissonScoredSortedSet extends RedissonExpirable implements RSc return commandExecutor.readAsync(getName(), StringCodec.INSTANCE, RedisCommands.ZRANGEBYLEX, getName(), fromValue, toValue); } + @Override + public Integer lexCountTail(V fromElement, boolean fromInclusive) { + return get(lexCountTailAsync(fromElement, fromInclusive)); + } + + @Override + public Future lexCountTailAsync(V fromElement, boolean fromInclusive) { + String fromValue = value(fromElement, fromInclusive); + + return commandExecutor.readAsync(getName(), RedisCommands.ZLEXCOUNT, getName(), fromValue, "+"); + } + + @Override + public Integer lexCountHead(V toElement, boolean toInclusive) { + return get(lexCountHeadAsync(toElement, toInclusive)); + } + + @Override + public Future lexCountHeadAsync(V toElement, boolean toInclusive) { + String toValue = value(toElement, toInclusive); + + return commandExecutor.readAsync(getName(), RedisCommands.ZLEXCOUNT, getName(), "-", toValue); + } + @Override public Integer lexCount(V fromElement, boolean fromInclusive, V toElement, boolean toInclusive) { return get(lexCountAsync(fromElement, fromInclusive, toElement, toInclusive)); diff --git a/src/main/java/org/redisson/core/RScoredSortedSet.java b/src/main/java/org/redisson/core/RScoredSortedSet.java index 0bd11216f..6b48b816c 100644 --- a/src/main/java/org/redisson/core/RScoredSortedSet.java +++ b/src/main/java/org/redisson/core/RScoredSortedSet.java @@ -21,6 +21,10 @@ import org.redisson.client.protocol.ScoredEntry; public interface RScoredSortedSet extends RScoredSortedSetAsync, Iterable, RExpirable { + Integer lexCountTail(V fromElement, boolean fromInclusive); + + Integer lexCountHead(V toElement, boolean toInclusive); + Collection lexRangeTail(V fromElement, boolean fromInclusive); Collection lexRangeHead(V toElement, boolean toInclusive); diff --git a/src/main/java/org/redisson/core/RScoredSortedSetAsync.java b/src/main/java/org/redisson/core/RScoredSortedSetAsync.java index 5e9b7f013..9af7b60d5 100644 --- a/src/main/java/org/redisson/core/RScoredSortedSetAsync.java +++ b/src/main/java/org/redisson/core/RScoredSortedSetAsync.java @@ -23,6 +23,10 @@ import io.netty.util.concurrent.Future; public interface RScoredSortedSetAsync extends RExpirableAsync { + Future lexCountTailAsync(V fromElement, boolean fromInclusive); + + Future lexCountHeadAsync(V toElement, boolean toInclusive); + Future> lexRangeTailAsync(V fromElement, boolean fromInclusive); Future> lexRangeHeadAsync(V toElement, boolean toInclusive);