lexCountTail & lexCountHead methods added. #143

pull/255/head
Nikita 10 years ago
parent 4877152190
commit 3ab7e1afc8

@ -313,6 +313,30 @@ public class RedissonScoredSortedSet<V> 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<Integer> 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<Integer> 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));

@ -21,6 +21,10 @@ import org.redisson.client.protocol.ScoredEntry;
public interface RScoredSortedSet<V> extends RScoredSortedSetAsync<V>, Iterable<V>, RExpirable {
Integer lexCountTail(V fromElement, boolean fromInclusive);
Integer lexCountHead(V toElement, boolean toInclusive);
Collection<V> lexRangeTail(V fromElement, boolean fromInclusive);
Collection<V> lexRangeHead(V toElement, boolean toInclusive);

@ -23,6 +23,10 @@ import io.netty.util.concurrent.Future;
public interface RScoredSortedSetAsync<V> extends RExpirableAsync {
Future<Integer> lexCountTailAsync(V fromElement, boolean fromInclusive);
Future<Integer> lexCountHeadAsync(V toElement, boolean toInclusive);
Future<Collection<V>> lexRangeTailAsync(V fromElement, boolean fromInclusive);
Future<Collection<V>> lexRangeHeadAsync(V toElement, boolean toInclusive);

Loading…
Cancel
Save