RSetReactive.diff, RSetReactive.intersection added

pull/555/head
Nikita 9 years ago
parent 6187079d45
commit 39f02d29c7

@ -71,4 +71,23 @@ public interface RSetReactive<V> extends RCollectionReactive<V> {
* @return
*/
Publisher<Set<V>> readUnion(String... names);
/**
* Diff sets specified by name and write to current set.
* If current set already exists, it is overwritten.
*
* @param names
* @return
*/
Publisher<Long> diff(String... names);
/**
* Intersection sets specified by name and write to current set.
* If current set already exists, it is overwritten.
*
* @param names
* @return
*/
Publisher<Long> intersection(String... names);
}

@ -142,6 +142,8 @@ public interface RedisCommands {
RedisStrictCommand<Integer> SDIFFSTORE_INT = new RedisStrictCommand<Integer>("SDIFFSTORE", new IntegerReplayConvertor());
RedisStrictCommand<Integer> SINTERSTORE_INT = new RedisStrictCommand<Integer>("SINTERSTORE", new IntegerReplayConvertor());
RedisStrictCommand<Long> SUNIONSTORE = new RedisStrictCommand<Long>("SUNIONSTORE");
RedisStrictCommand<Long> SINTERSTORE = new RedisStrictCommand<Long>("SINTERSTORE");
RedisStrictCommand<Long> SDIFFSTORE = new RedisStrictCommand<Long>("SDIFFSTORE");
RedisCommand<Set<Object>> SUNION = new RedisCommand<Set<Object>>("SUNION", new ObjectSetReplayDecoder<Object>());
RedisCommand<Set<Object>> SDIFF = new RedisCommand<Set<Object>>("SDIFF", new ObjectSetReplayDecoder<Object>());
RedisCommand<Set<Object>> SINTER = new RedisCommand<Set<Object>>("SINTER", new ObjectSetReplayDecoder<Object>());

@ -118,6 +118,22 @@ public class RedissonSetReactive<V> extends RedissonExpirableReactive implements
return reactive(instance.removeAllAsync(c));
}
@Override
public Publisher<Long> intersection(String... names) {
List<Object> args = new ArrayList<Object>(names.length + 1);
args.add(getName());
args.addAll(Arrays.asList(names));
return commandExecutor.writeReactive(getName(), codec, RedisCommands.SINTERSTORE, args.toArray());
}
@Override
public Publisher<Long> diff(String... names) {
List<Object> args = new ArrayList<Object>(names.length + 1);
args.add(getName());
args.addAll(Arrays.asList(names));
return commandExecutor.writeReactive(getName(), codec, RedisCommands.SDIFFSTORE, args.toArray());
}
@Override
public Publisher<Long> union(String... names) {
List<Object> args = new ArrayList<Object>(names.length + 1);

Loading…
Cancel
Save