Skip to content

Commit 34b8454

Browse files
committed
Introduce LettuceInvoker.
We now use LettuceInvoker to call Lettuce API methods for synchronous, pipelining, and transactional execution models. LettuceInvoker captures the method invocation as functional utility and allows conversion of results: Long result = invoker.just(RedisGeoAsyncCommands::geoadd, key, point.getX(), point.getY(), member); List<byte[]> result = invoker.fromMany(RedisGeoAsyncCommands::geohash, key, members) .toList(it -> it.getValueOrElse(null)); Closes #1797
1 parent d0df07a commit 34b8454

18 files changed

+1259
-3441
lines changed

src/main/java/org/springframework/data/redis/connection/RedisListCommands.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ default Long lPos(byte[] key, byte[] element) {
7575
* @see <a href="https://redis.io/commands/lpos">Redis Documentation: LPOS</a>
7676
* @since 2.4
7777
*/
78+
@Nullable
7879
List<Long> lPos(byte[] key, byte[] element, @Nullable Integer rank, @Nullable Integer count);
7980

8081
/**

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceClusterHyperLogLogCommands.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,9 @@ class LettuceClusterHyperLogLogCommands extends LettuceHyperLogLogCommands {
3838
public Long pfCount(byte[]... keys) {
3939

4040
if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) {
41-
42-
try {
43-
return super.pfCount(keys);
44-
} catch (Exception ex) {
45-
throw convertLettuceAccessException(ex);
46-
}
47-
41+
return super.pfCount(keys);
4842
}
43+
4944
throw new InvalidDataAccessApiUsageException("All keys must map to same slot for pfcount in cluster mode.");
5045
}
5146

@@ -59,14 +54,10 @@ public void pfMerge(byte[] destinationKey, byte[]... sourceKeys) {
5954
byte[][] allKeys = ByteUtils.mergeArrays(destinationKey, sourceKeys);
6055

6156
if (ClusterSlotHashUtil.isSameSlotForAllKeys(allKeys)) {
62-
try {
63-
super.pfMerge(destinationKey, sourceKeys);
64-
return;
65-
} catch (Exception ex) {
66-
throw convertLettuceAccessException(ex);
67-
}
68-
57+
super.pfMerge(destinationKey, sourceKeys);
58+
return;
6959
}
60+
7061
throw new InvalidDataAccessApiUsageException("All keys must map to same slot for pfmerge in cluster mode.");
7162
}
7263
}

0 commit comments

Comments
 (0)