Support Sorted Set with LEX commands

* new commands : ZLEXCOUNT, ZRANGEBYLEX, ZREMRANGEBYLEX
** added commands to Jedis, ShardedJedis, JedisCluster, PipelineBase with Binary
/ Normal(String)
** description links
*** http://redis.io/commands/zlexcount
*** http://redis.io/commands/zrangebylex
*** http://redis.io/commands/zremrangebylex
** Unit test included
This commit is contained in:
Jungtaek Lim
2014-04-22 23:39:37 +09:00
parent ac53759f97
commit 409740f06c
14 changed files with 396 additions and 2 deletions

View File

@@ -1063,6 +1063,51 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}
}.run(key);
}
@Override
public Long zlexcount(final String key, final String min, final String max) {
return new JedisClusterCommand<Long>(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zlexcount(key, min, max);
}
}.run(key);
}
@Override
public Set<String> zrangeByLex(final String key, final String min, final String max) {
return new JedisClusterCommand<Set<String>>(connectionHandler, timeout,
maxRedirections) {
@Override
public Set<String> execute(Jedis connection) {
return connection.zrangeByLex(key, min, max);
}
}.run(key);
}
@Override
public Set<String> zrangeByLex(final String key, final String min, final String max,
final int offset, final int count) {
return new JedisClusterCommand<Set<String>>(connectionHandler, timeout,
maxRedirections) {
@Override
public Set<String> execute(Jedis connection) {
return connection.zrangeByLex(key, min, max, offset, count);
}
}.run(key);
}
@Override
public Long zremrangeByLex(final String key, final String min, final String max) {
return new JedisClusterCommand<Long>(connectionHandler, timeout,
maxRedirections) {
@Override
public Long execute(Jedis connection) {
return connection.zremrangeByLex(key, min, max);
}
}.run(key);
}
@Override
public Long linsert(final String key, final LIST_POSITION where,
@@ -1481,4 +1526,5 @@ public class JedisCluster implements JedisCommands, BasicCommands {
}
}.run(null);
}
}