Skip to content

Commit bc983fe

Browse files
committed
Refine HMGET and MGET documentation.
Closes #2309
1 parent a0bcf01 commit bc983fe

10 files changed

+29
-18
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ default Mono<ByteBuffer> hGet(ByteBuffer key, ByteBuffer field) {
288288
}
289289

290290
/**
291-
* Get values for given {@literal fields} from hash at {@literal key}.
291+
* Get values for given {@literal fields} from hash at {@literal key}. Values are in the order of the requested keys.
292+
* Absent field values are represented using {@code null} in the resulting {@link List}.
292293
*
293294
* @param key must not be {@literal null}.
294295
* @param fields must not be {@literal null}.
@@ -304,7 +305,8 @@ default Mono<List<ByteBuffer>> hMGet(ByteBuffer key, Collection<ByteBuffer> fiel
304305
}
305306

306307
/**
307-
* Get values for given {@literal fields} from hash at {@literal key}.
308+
* Get values for given {@literal fields} from hash at {@literal key}. Values are in the order of the requested keys.
309+
* Absent field values are represented using {@code null} in the resulting {@link List}.
308310
*
309311
* @param commands must not be {@literal null}.
310312
* @return

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ default Mono<ByteBuffer> getSet(ByteBuffer key, ByteBuffer value) {
349349
Flux<ByteBufferResponse<SetCommand>> getSet(Publisher<SetCommand> commands);
350350

351351
/**
352-
* Get multiple values in one batch.
352+
* Get multiple values in one batch. Values are in the order of the requested keys. Absent field values are
353+
* represented using {@code null} in the resulting {@link List}.
353354
*
354355
* @param keys must not be {@literal null}.
355356
* @return
@@ -363,7 +364,8 @@ default Mono<List<ByteBuffer>> mGet(List<ByteBuffer> keys) {
363364
}
364365

365366
/**
366-
* Get multiple values at for {@literal keysets} in batches.
367+
* Get multiple values at for {@literal keysets} in batches. Values are in the order of the requested keys. Absent
368+
* field values are represented using {@code null} in the resulting {@link List}.
367369
*
368370
* @param keysets must not be {@literal null}.
369371
* @return

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ public interface RedisHashCommands {
6868
byte[] hGet(byte[] key, byte[] field);
6969

7070
/**
71-
* Get values for given {@code fields} from hash at {@code key}.
71+
* Get values for given {@code fields} from hash at {@code key}. Values are in the order of the requested keys Absent
72+
* field values are represented using {@code null} in the resulting {@link List}.
7273
*
7374
* @param key must not be {@literal null}.
7475
* @param fields must not be {@literal empty}.
75-
* @return empty {@link List} if key or fields do not exists. {@literal null} when used in pipeline / transaction.
76+
* @return empty {@link List} if key does not exist. {@literal null} when used in pipeline / transaction.
7677
* @see <a href="https://redis.io/commands/hmget">Redis Documentation: HMGET</a>
7778
*/
7879
@Nullable

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ enum BitOperation {
8585
byte[] getSet(byte[] key, byte[] value);
8686

8787
/**
88-
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
88+
* Get multiple {@code keys}. Values are in the order of the requested keys Absent field values are represented using
89+
* {@code null} in the resulting {@link List}.
8990
*
9091
* @param keys must not be {@literal null}.
91-
* @return empty {@link List} if keys do not exist or when used in pipeline / transaction.
92+
* @return {@code null} when used in pipeline / transaction.
9293
* @see <a href="https://redis.io/commands/mget">Redis Documentation: MGET</a>
9394
*/
9495
@Nullable

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ interface StringTuple extends Tuple {
437437
String getSet(String key, String value);
438438

439439
/**
440-
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
440+
* Get multiple {@code keys}. Values are in the order of the requested keys.
441441
*
442442
* @param keys must not be {@literal null}.
443443
* @return

src/main/java/org/springframework/data/redis/core/BoundHashOperations.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
6060
HV get(Object member);
6161

6262
/**
63-
* Get values for given {@code keys} from the hash at the bound key.
63+
* Get values for given {@code keys} from the hash at the bound key. Values are in the order of the requested keys
64+
* Absent field values are represented using {@code null} in the resulting {@link List}.
6465
*
6566
* @param keys must not be {@literal null}.
6667
* @return {@literal null} when used in pipeline / transaction.

src/main/java/org/springframework/data/redis/core/HashOperations.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public interface HashOperations<H, HK, HV> {
6060
HV get(H key, Object hashKey);
6161

6262
/**
63-
* Get values for given {@code hashKeys} from hash at {@code key}.
63+
* Get values for given {@code hashKeys} from hash at {@code key}. Values are in the order of the requested keys
64+
* Absent field values are represented using {@code null} in the resulting {@link List}.
6465
*
6566
* @param key must not be {@literal null}.
6667
* @param hashKeys must not be {@literal null}.

src/main/java/org/springframework/data/redis/core/ReactiveHashOperations.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public interface ReactiveHashOperations<H, HK, HV> {
5959
Mono<HV> get(H key, Object hashKey);
6060

6161
/**
62-
* Get values for given {@code hashKeys} from hash at {@code key}.
62+
* Get values for given {@code hashKeys} from hash at {@code key}. Values are in the order of the requested keys.
63+
* Absent field values are represented using {@code null} in the resulting {@link List}.
6364
*
6465
* @param key must not be {@literal null}.
6566
* @param hashKeys must not be {@literal null}.
@@ -122,10 +123,10 @@ public interface ReactiveHashOperations<H, HK, HV> {
122123
Flux<HK> randomKeys(H key, long count);
123124

124125
/**
125-
* Return random entries from the hash stored at {@code key}. If the provided {@code count} argument is
126-
* positive, return a list of distinct entries, capped either at {@code count} or the hash size. If {@code count} is
127-
* negative, the behavior changes and the command is allowed to return the same entry multiple times. In this case,
128-
* the number of returned fields is the absolute value of the specified count.
126+
* Return random entries from the hash stored at {@code key}. If the provided {@code count} argument is positive,
127+
* return a list of distinct entries, capped either at {@code count} or the hash size. If {@code count} is negative,
128+
* the behavior changes and the command is allowed to return the same entry multiple times. In this case, the number
129+
* of returned fields is the absolute value of the specified count.
129130
*
130131
* @param key must not be {@literal null}.
131132
* @param count number of fields to return.

src/main/java/org/springframework/data/redis/core/ReactiveValueOperations.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ public interface ReactiveValueOperations<K, V> {
155155
Mono<V> getAndSet(K key, V value);
156156

157157
/**
158-
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
158+
* Get multiple {@code keys}. Values are in the order of the requested keys. Absent field values are represented using
159+
* {@code null} in the resulting {@link List}.
159160
*
160161
* @param keys must not be {@literal null}.
161162
* @see <a href="https://redis.io/commands/mget">Redis Documentation: MGET</a>

src/main/java/org/springframework/data/redis/core/ValueOperations.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ default Boolean setIfPresent(K key, V value, Duration timeout) {
263263
V getAndSet(K key, V value);
264264

265265
/**
266-
* Get multiple {@code keys}. Values are returned in the order of the requested keys.
266+
* Get multiple {@code keys}. Values are in the order of the requested keys Absent field values are represented using
267+
* {@code null} in the resulting {@link List}.
267268
*
268269
* @param keys must not be {@literal null}.
269270
* @return {@literal null} when used in pipeline / transaction.

0 commit comments

Comments
 (0)