RKeys.getSlot method added. #289

pull/297/head
Nikita 9 years ago
parent 477c2ceb3c
commit 7515e3b5d1

@ -41,6 +41,16 @@ public class RedissonKeys implements RKeys {
this.commandExecutor = commandExecutor;
}
@Override
public int getSlot(String key) {
return commandExecutor.get(getSlotAsync(key));
}
@Override
public Future<Integer> getSlotAsync(String key) {
return commandExecutor.readAsync(null, RedisCommands.KEYSLOT, key);
}
@Override
public Iterable<String> getKeysByPattern(final String pattern) {
List<Iterable<String>> iterables = new ArrayList<Iterable<String>>();

@ -51,6 +51,8 @@ import org.redisson.client.protocol.pubsub.PubSubStatusDecoder;
public interface RedisCommands {
RedisStrictCommand<Integer> KEYSLOT = new RedisStrictCommand<Integer>("CLUSTER", "KEYSLOT", new IntegerReplayConvertor());
RedisStrictCommand<Boolean> GETBIT = new RedisStrictCommand<Boolean>("GETBIT", new BooleanReplayConvertor());
RedisStrictCommand<Integer> BITS_SIZE = new RedisStrictCommand<Integer>("STRLEN", new BitsSizeReplayConvertor());
RedisStrictCommand<Integer> STRLEN = new RedisStrictCommand<Integer>("STRLEN", new IntegerReplayConvertor());

@ -19,6 +19,15 @@ import java.util.Collection;
public interface RKeys extends RKeysAsync {
/**
* Get hash slot identifier for key.
* Available for cluster nodes only
*
* @param key
* @return
*/
int getSlot(String key);
/**
* Get all keys by pattern using iterator. Keys traversing with SCAN operation
*

@ -21,6 +21,15 @@ import io.netty.util.concurrent.Future;
public interface RKeysAsync {
/**
* Get hash slot identifier for key in async mode.
* Available for cluster nodes only
*
* @param key
* @return
*/
Future<Integer> getSlotAsync(String key);
/**
* Get random key in async mode
*

Loading…
Cancel
Save