Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/jedis5-breaking.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
- `blpop(double timeout, byte[]... keys)`
- `brpop(double timeout, byte[]... keys)`

- `zdiff(String... keys)` method now returns `List<String>` (instead of `Set<String>`).
- `zdiff(byte[]... keys)` method now returns `List<byte[]>` (instead of `Set<byte[]>`).
- Both `zdiffWithScores(String... keys)` and `zdiffWithScores(byte[]... keys)` methods now return `List<Tuple>` (instead of `Set<Tuple>`).

- `zinter(ZParams params, String... keys)` method now returns `List<String>` (instead of `Set<String>`).
- `zinter(ZParams params, byte[]... keys)` method now returns `List<byte[]>` (instead of `Set<byte[]>`).
- Both `zinterWithScores(ZParams params, String... keys)` and `zinterWithScores(ZParams params, byte[]... keys)` methods now return `List<Tuple>` (instead of `Set<Tuple>`).

- `zunion(ZParams params, String... keys)` method now returns `List<String>` (instead of `Set<String>`).
- `zunion(ZParams params, byte[]... keys)` method now returns `List<byte[]>` (instead of `Set<byte[]>`).
- Both `zunionWithScores(ZParams params, String... keys)` and `zunionWithScores(ZParams params, byte[]... keys)` methods now return `List<Tuple>` (instead of `Set<Tuple>`).
Comment on lines +17 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


- `getAgeSeconds()` in `AccessControlLogEntry` now returns `Double` instead of `String`.

- `graphSlowlog(String graphName)` now returns `List<List<Object>>` (instead of `List<List<String>>`).
Expand All @@ -30,6 +42,7 @@
- `BYTE_ARRAY` (use `BINARY`)
- `BYTE_ARRAY_LIST` (use `BINARY_LIST`)
- `BINARY_MAP_FROM_PAIRS`
- `STRING_ORDERED_SET`

- `Queable` class is removed.

Expand Down
15 changes: 0 additions & 15 deletions src/main/java/redis/clients/jedis/BuilderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,6 @@ public String toString() {
}
};

public static final Builder<Set<String>> STRING_ORDERED_SET = new Builder<Set<String>>() {
@Override
@SuppressWarnings("unchecked")
public Set<String> build(Object data) {
if (null == data) return null;
return ((List<Object>) data).stream().map(STRING::build)
.collect(Collectors.toCollection(LinkedHashSet::new));
}

@Override
public String toString() {
return "Set<String>";
}
};

public static final Builder<Map<String, String>> STRING_MAP = new Builder<Map<String, String>>() {
@Override
@SuppressWarnings("unchecked")
Expand Down
68 changes: 35 additions & 33 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -1804,51 +1804,53 @@ public final CommandObject<ScanResult<Tuple>> zscan(byte[] key, byte[] cursor, S
return new CommandObject<>(commandArguments(ZSCAN).key(key).add(cursor).addParams(params), BuilderFactory.ZSCAN_RESPONSE);
}

public final CommandObject<Set<String>> zdiff(String... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys), BuilderFactory.STRING_ORDERED_SET);
public final CommandObject<List<String>> zdiff(String... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys),
BuilderFactory.STRING_LIST);
}

public final CommandObject<Set<Tuple>> zdiffWithScores(String... keys) {
public final CommandObject<List<Tuple>> zdiffWithScores(String... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys)
.add(WITHSCORES), getTupleSetBuilder());
.add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<Long> zdiffStore(String dstkey, String... keys) {
return new CommandObject<>(commandArguments(ZDIFFSTORE).key(dstkey).add(keys.length).keys((Object[]) keys), BuilderFactory.LONG);
return new CommandObject<>(commandArguments(ZDIFFSTORE).key(dstkey)
.add(keys.length).keys((Object[]) keys), BuilderFactory.LONG);
}

public final CommandObject<Set<byte[]>> zdiff(byte[]... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys), BuilderFactory.BINARY_SET);
public final CommandObject<List<byte[]>> zdiff(byte[]... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys), BuilderFactory.BINARY_LIST);
}

public final CommandObject<Set<Tuple>> zdiffWithScores(byte[]... keys) {
public final CommandObject<List<Tuple>> zdiffWithScores(byte[]... keys) {
return new CommandObject<>(commandArguments(ZDIFF).add(keys.length).keys((Object[]) keys)
.add(WITHSCORES), getTupleSetBuilder());
.add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<Long> zdiffStore(byte[] dstkey, byte[]... keys) {
return new CommandObject<>(commandArguments(ZDIFFSTORE).key(dstkey)
.add(keys.length).keys((Object[]) keys), BuilderFactory.LONG);
}

public final CommandObject<Long> zinterstore(String dstkey, String... sets) {
return new CommandObject<>(commandArguments(ZINTERSTORE).key(dstkey)
.add(sets.length).keys((Object[]) sets), BuilderFactory.LONG);
public final CommandObject<List<String>> zinter(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params), BuilderFactory.STRING_LIST);
}

public final CommandObject<Long> zinterstore(String dstkey, ZParams params, String... sets) {
return new CommandObject<>(commandArguments(ZINTERSTORE).key(dstkey)
.add(sets.length).keys((Object[]) sets).addParams(params), BuilderFactory.LONG);
public final CommandObject<List<Tuple>> zinterWithScores(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params).add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<Set<String>> zinter(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params), BuilderFactory.STRING_ORDERED_SET);
public final CommandObject<Long> zinterstore(String dstkey, String... keys) {
return new CommandObject<>(commandArguments(ZINTERSTORE).key(dstkey)
.add(keys.length).keys((Object[]) keys), BuilderFactory.LONG);
}

public final CommandObject<Set<Tuple>> zinterWithScores(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params).add(WITHSCORES), getTupleSetBuilder());
public final CommandObject<Long> zinterstore(String dstkey, ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZINTERSTORE).key(dstkey)
.add(keys.length).keys((Object[]) keys).addParams(params), BuilderFactory.LONG);
}

public final CommandObject<Long> zintercard(String... keys) {
Expand Down Expand Up @@ -1881,14 +1883,14 @@ public final CommandObject<Long> zintercard(long limit, byte[]... keys) {
.keys((Object[]) keys).add(LIMIT).add(limit), BuilderFactory.LONG);
}

public final CommandObject<Set<byte[]>> zinter(ZParams params, byte[]... keys) {
public final CommandObject<List<byte[]>> zinter(ZParams params, byte[]... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params), BuilderFactory.BINARY_SET);
.addParams(params), BuilderFactory.BINARY_LIST);
}

public final CommandObject<Set<Tuple>> zinterWithScores(ZParams params, byte[]... keys) {
public final CommandObject<List<Tuple>> zinterWithScores(ZParams params, byte[]... keys) {
return new CommandObject<>(commandArguments(ZINTER).add(keys.length).keys((Object[]) keys)
.addParams(params).add(WITHSCORES), getTupleSetBuilder());
.addParams(params).add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<Long> zunionstore(String dstkey, String... sets) {
Expand All @@ -1901,14 +1903,14 @@ public final CommandObject<Long> zunionstore(String dstkey, ZParams params, Stri
.add(sets.length).keys((Object[]) sets).addParams(params), BuilderFactory.LONG);
}

public final CommandObject<Set<String>> zunion(ZParams params, String... keys) {
public final CommandObject<List<String>> zunion(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZUNION).add(keys.length).keys((Object[]) keys)
.addParams(params), BuilderFactory.STRING_ORDERED_SET);
.addParams(params), BuilderFactory.STRING_LIST);
}

public final CommandObject<Set<Tuple>> zunionWithScores(ZParams params, String... keys) {
public final CommandObject<List<Tuple>> zunionWithScores(ZParams params, String... keys) {
return new CommandObject<>(commandArguments(ZUNION).add(keys.length).keys((Object[]) keys)
.addParams(params).add(WITHSCORES), getTupleSetBuilder());
.addParams(params).add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<Long> zunionstore(byte[] dstkey, byte[]... sets) {
Expand All @@ -1921,14 +1923,14 @@ public final CommandObject<Long> zunionstore(byte[] dstkey, ZParams params, byte
.add(sets.length).keys((Object[]) sets).addParams(params), BuilderFactory.LONG);
}

public final CommandObject<Set<byte[]>> zunion(ZParams params, byte[]... keys) {
public final CommandObject<List<byte[]>> zunion(ZParams params, byte[]... keys) {
return new CommandObject<>(commandArguments(ZUNION).add(keys.length).keys((Object[]) keys)
.addParams(params), BuilderFactory.BINARY_SET);
.addParams(params), BuilderFactory.BINARY_LIST);
}

public final CommandObject<Set<Tuple>> zunionWithScores(ZParams params, byte[]... keys) {
public final CommandObject<List<Tuple>> zunionWithScores(ZParams params, byte[]... keys) {
return new CommandObject<>(commandArguments(ZUNION).add(keys.length).keys((Object[]) keys)
.addParams(params).add(WITHSCORES), getTupleSetBuilder());
.addParams(params).add(WITHSCORES), getTupleListBuilder());
}

public final CommandObject<KeyValue<String, List<Tuple>>> zmpop(SortedSetOption option, String... keys) {
Expand Down
34 changes: 17 additions & 17 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -2688,13 +2688,13 @@ public long zcount(final byte[] key, final byte[] min, final byte[] max) {
}

@Override
public Set<byte[]> zdiff(final byte[]... keys) {
public List<byte[]> zdiff(final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zdiff(keys));
}

@Override
public Set<Tuple> zdiffWithScores(final byte[]... keys) {
public List<Tuple> zdiffWithScores(final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zdiffWithScores(keys));
}
Expand Down Expand Up @@ -3048,26 +3048,26 @@ public long zremrangeByScore(final byte[] key, final byte[] min, final byte[] ma

/**
* Add multiple sorted sets, This command is similar to ZUNIONSTORE, but instead of storing the
resulting sorted set, it is returned to the connection.
* resulting sorted set, it is returned to the connection.
* @param params
* @param keys
* @return The result of the union
*/
@Override
public Set<byte[]> zunion(final ZParams params, final byte[]... keys) {
public List<byte[]> zunion(final ZParams params, final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zunion(params, keys));
}

/**
* Add multiple sorted sets with scores, This command is similar to ZUNIONSTORE, but instead of storing the
* resulting sorted set, it is returned to the connection.
* Add multiple sorted sets with scores, This command is similar to ZUNIONSTORE, but instead of
* storing the resulting sorted set, it is returned to the connection.
* @param params
* @param keys
* @return The result of the union with their scores
*/
@Override
public Set<Tuple> zunionWithScores(final ZParams params, final byte[]... keys) {
public List<Tuple> zunionWithScores(final ZParams params, final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zunionWithScores(params, keys));
}
Expand Down Expand Up @@ -3144,7 +3144,7 @@ public long zunionstore(final byte[] dstkey, final ZParams params, final byte[].
* @return The result of the intersection
*/
@Override
public Set<byte[]> zinter(final ZParams params, final byte[]... keys) {
public List<byte[]> zinter(final ZParams params, final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zinter(params, keys));
}
Expand All @@ -3157,7 +3157,7 @@ public Set<byte[]> zinter(final ZParams params, final byte[]... keys) {
* @return The result of the intersection with scores
*/
@Override
public Set<Tuple> zinterWithScores(final ZParams params, final byte[]... keys) {
public List<Tuple> zinterWithScores(final ZParams params, final byte[]... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zinterWithScores(params, keys));
}
Expand Down Expand Up @@ -6248,7 +6248,7 @@ public long sinterstore(final String dstkey, final String... keys) {
}

/**
* This command works exactly like {@link Jedis#sinter(String[]) SINTER} but instead of returning
* This command works exactly like {@link Jedis#sinter(String...) SINTER} but instead of returning
* the result set, it returns just the cardinality of the result.
* <p>
* Time complexity O(N*M) worst case where N is the cardinality of the smallest
Expand All @@ -6262,7 +6262,7 @@ public long sintercard(String... keys) {
}

/**
* This command works exactly like {@link Jedis#sinter(String[]) SINTER} but instead of returning
* This command works exactly like {@link Jedis#sinter(String...) SINTER} but instead of returning
* the result set, it returns just the cardinality of the result.
* <p>
* Time complexity O(N*M) worst case where N is the cardinality of the smallest
Expand Down Expand Up @@ -6434,13 +6434,13 @@ public Double zaddIncr(final String key, final double score, final String member
}

@Override
public Set<String> zdiff(String... keys) {
public List<String> zdiff(String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zdiff(keys));
}

@Override
public Set<Tuple> zdiffWithScores(String... keys) {
public List<Tuple> zdiffWithScores(String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zdiffWithScores(keys));
}
Expand Down Expand Up @@ -7426,7 +7426,7 @@ public long zremrangeByScore(final String key, final String min, final String ma
* @return A set with members of the resulting set
*/
@Override
public Set<String> zunion(ZParams params, String... keys) {
public List<String> zunion(ZParams params, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zunion(params, keys));
}
Expand All @@ -7439,7 +7439,7 @@ public Set<String> zunion(ZParams params, String... keys) {
* @return A set with members of the resulting set with scores
*/
@Override
public Set<Tuple> zunionWithScores(ZParams params, String... keys) {
public List<Tuple> zunionWithScores(ZParams params, String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zunionWithScores(params, keys));
}
Expand Down Expand Up @@ -7525,7 +7525,7 @@ public long zunionstore(final String dstkey, final ZParams params, final String.
* @return A set with members of the resulting set
*/
@Override
public Set<String> zinter(final ZParams params, final String... keys) {
public List<String> zinter(final ZParams params, final String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zinter(params, keys));
}
Expand All @@ -7538,7 +7538,7 @@ public Set<String> zinter(final ZParams params, final String... keys) {
* @return A set with members of the resulting set with scores
*/
@Override
public Set<Tuple> zinterWithScores(final ZParams params, final String... keys) {
public List<Tuple> zinterWithScores(final ZParams params, final String... keys) {
checkIsInMultiOrPipeline();
return connection.executeCommand(commandObjects.zinterWithScores(params, keys));
}
Expand Down
Loading