RKeys.delete execution optimization in non cluster mode

pull/395/head
Nikita 9 years ago
parent 7583397694
commit 7bd8998575

@ -251,6 +251,10 @@ public class RedissonKeys implements RKeys {
*/
@Override
public Future<Long> deleteAsync(String ... keys) {
if (!commandExecutor.getConnectionManager().isClusterMode()) {
return commandExecutor.writeAsync(null, RedisCommands.DEL, keys);
}
Map<ClusterSlotRange, List<String>> range2key = new HashMap<ClusterSlotRange, List<String>>();
for (String key : keys) {
int slot = commandExecutor.getConnectionManager().calcSlot(key);

@ -226,11 +226,10 @@ public class CommandAsyncService implements CommandAsyncExecutor {
private NodeSource getNodeSource(String key) {
int slot = connectionManager.calcSlot(key);
NodeSource source = NodeSource.ZERO;
if (slot != 0) {
source = new NodeSource(slot);
return new NodeSource(slot);
}
return source;
return NodeSource.ZERO;
}
@Override

@ -43,6 +43,8 @@ import io.netty.util.concurrent.Promise;
*/
public interface ConnectionManager {
boolean isClusterMode();
<R> Future<R> newSucceededFuture(R value);
ConnectionEventsHub getConnectionEventsHub();

@ -116,6 +116,8 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
protected MasterSlaveServersConfig config;
protected boolean isClusterMode;
protected final Map<ClusterSlotRange, MasterSlaveEntry> entries = PlatformDependent.newConcurrentHashMap();
private final InfinitySemaphoreLatch shutdownLatch = new InfinitySemaphoreLatch();
@ -150,6 +152,11 @@ public class MasterSlaveConnectionManager implements ConnectionManager {
this.socketChannelClass = NioSocketChannel.class;
}
this.codec = cfg.getCodec();
this.isClusterMode = cfg.isClusterConfig();
}
public boolean isClusterMode() {
return isClusterMode;
}
public IdleConnectionWatcher getConnectionWatcher() {

Loading…
Cancel
Save