Skip to content

Commit

Permalink
Allow coordinated cross-slot execution using Iterable #303
Browse files Browse the repository at this point in the history
mget, del and unlink provide methods with var-args signatures and declare signatures accepting Iterable. Only methods accepting varargs allow coordinated cross-slot execution. The other methods accepting Iterable fail because cross-slot keys are sent directly to Redis and not coordinated amongst Redis Cluster nodes.
  • Loading branch information
Godet Alexandre authored and mp911de committed Jul 7, 2016
1 parent 640a833 commit 88e7051
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public RedisFuture<Long> unlink(K... keys) {
}

@Override
public RedisFuture<List<V>> mget(K... keys) {
Map<Integer, List<K>> partitioned = SlotHash.partition(codec, Arrays.asList(keys));
public RedisFuture<List<V>> mget(Iterable<K> keys) {
Map<Integer, List<K>> partitioned = SlotHash.partition(codec, keys);

if (partitioned.size() < 2) {
return super.mget(keys);
Expand Down Expand Up @@ -120,6 +120,11 @@ public RedisFuture<List<V>> mget(K... keys) {
});
}

@Override
public RedisFuture<List<V>> mget(K... keys) {
return mget(Arrays.asList(keys));
}

@Override
public RedisFuture<Long> mget(ValueStreamingChannel<V> channel, K... keys) {
Map<Integer, List<K>> partitioned = SlotHash.partition(codec, Arrays.asList(keys));
Expand Down

0 comments on commit 88e7051

Please sign in to comment.