Skip to content

Commit 92d62f1

Browse files
committed
Refine documentation of HRANDFIELD and HRANDFIELD … WITHVALUES.
The documentation is now more precise about the return value. Closes #2407
1 parent 1507402 commit 92d62f1

File tree

6 files changed

+43
-43
lines changed

6 files changed

+43
-43
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ public long getCount() {
563563
}
564564

565565
/**
566-
* Return a random field from the hash value stored at {@code key}.
566+
* Return a random field from the hash stored at {@code key}.
567567
*
568568
* @param key must not be {@literal null}.
569569
* @return
@@ -578,7 +578,7 @@ default Mono<ByteBuffer> hRandField(ByteBuffer key) {
578578
}
579579

580580
/**
581-
* Return a random field from the hash value stored at {@code key}.
581+
* Return a random field from the hash along with its value stored at {@code key}.
582582
*
583583
* @param key must not be {@literal null}.
584584
* @return
@@ -594,10 +594,10 @@ default Mono<Map.Entry<ByteBuffer, ByteBuffer>> hRandFieldWithValues(ByteBuffer
594594
}
595595

596596
/**
597-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
598-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
599-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
600-
* the number of returned fields is the absolute value of the specified count.
597+
* Return a random field from the hash stored at {@code key}. If the provided {@code count} argument is positive,
598+
* return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is negative,
599+
* the behavior changes and the command is allowed to return the same field multiple times. In this case, the number
600+
* of returned fields is the absolute value of the specified count.
601601
*
602602
* @param key must not be {@literal null}.
603603
* @param count number of fields to return.
@@ -613,10 +613,10 @@ default Flux<ByteBuffer> hRandField(ByteBuffer key, long count) {
613613
}
614614

615615
/**
616-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
617-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
618-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
619-
* the number of returned fields is the absolute value of the specified count.
616+
* Return a random field from the hash along with its value stored at {@code key}. If the provided {@code count}
617+
* argument is positive, return a list of distinct fields, capped either at {@code count} or the hash size. If
618+
* {@code count} is negative, the behavior changes and the command is allowed to return the same field multiple times.
619+
* In this case, the number of returned fields is the absolute value of the specified count.
620620
*
621621
* @param key must not be {@literal null}.
622622
* @param count number of fields to return.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public interface RedisHashCommands {
174174
Map<byte[], byte[]> hGetAll(byte[] key);
175175

176176
/**
177-
* Return a random field from the hash value stored at {@code key}.
177+
* Return a random field from the hash stored at {@code key}.
178178
*
179179
* @param key must not be {@literal null}.
180180
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -185,7 +185,7 @@ public interface RedisHashCommands {
185185
byte[] hRandField(byte[] key);
186186

187187
/**
188-
* Return a random field from the hash value stored at {@code key}.
188+
* Return a random field from the hash along with its value stored at {@code key}.
189189
*
190190
* @param key must not be {@literal null}.
191191
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -196,10 +196,10 @@ public interface RedisHashCommands {
196196
Map.Entry<byte[], byte[]> hRandFieldWithValues(byte[] key);
197197

198198
/**
199-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
200-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
201-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
202-
* the number of returned fields is the absolute value of the specified count.
199+
* Return a random field from the hash stored at {@code key}. If the provided {@code count} argument is positive,
200+
* return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is negative,
201+
* the behavior changes and the command is allowed to return the same field multiple times. In this case, the number
202+
* of returned fields is the absolute value of the specified count.
203203
*
204204
* @param key must not be {@literal null}.
205205
* @param count number of fields to return.
@@ -211,10 +211,10 @@ public interface RedisHashCommands {
211211
List<byte[]> hRandField(byte[] key, long count);
212212

213213
/**
214-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
215-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
216-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
217-
* the number of returned fields is the absolute value of the specified count.
214+
* Return a random field from the hash along with its value stored at {@code key}. If the provided {@code count}
215+
* argument is positive, return a list of distinct fields, capped either at {@code count} or the hash size. If
216+
* {@code count} is negative, the behavior changes and the command is allowed to return the same field multiple times.
217+
* In this case, the number of returned fields is the absolute value of the specified count.
218218
*
219219
* @param key must not be {@literal null}.
220220
* @param count number of fields to return.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ default Set<String> zRevRangeByLex(String key, Range range) {
20672067
Double hIncrBy(String key, String field, double delta);
20682068

20692069
/**
2070-
* Return a random field from the hash value stored at {@code key}.
2070+
* Return a random field from the hash stored at {@code key}.
20712071
*
20722072
* @param key must not be {@literal null}.
20732073
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -2078,7 +2078,7 @@ default Set<String> zRevRangeByLex(String key, Range range) {
20782078
String hRandField(String key);
20792079

20802080
/**
2081-
* Return a random field from the hash value stored at {@code key}.
2081+
* Return a random field from the hash along with its value stored at {@code key}.
20822082
*
20832083
* @param key must not be {@literal null}.
20842084
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -2089,10 +2089,10 @@ default Set<String> zRevRangeByLex(String key, Range range) {
20892089
Map.Entry<String, String> hRandFieldWithValues(String key);
20902090

20912091
/**
2092-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
2093-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
2094-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
2095-
* the number of returned fields is the absolute value of the specified count.
2092+
* Return a random field from the hash stored at {@code key}. If the provided {@code count} argument is positive,
2093+
* return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is negative,
2094+
* the behavior changes and the command is allowed to return the same field multiple times. In this case, the number
2095+
* of returned fields is the absolute value of the specified count.
20962096
*
20972097
* @param key must not be {@literal null}.
20982098
* @param count number of fields to return.
@@ -2104,10 +2104,10 @@ default Set<String> zRevRangeByLex(String key, Range range) {
21042104
List<String> hRandField(String key, long count);
21052105

21062106
/**
2107-
* Return a random field from the hash value stored at {@code key}. If the provided {@code count} argument is
2108-
* positive, return a list of distinct fields, capped either at {@code count} or the hash size. If {@code count} is
2109-
* negative, the behavior changes and the command is allowed to return the same field multiple times. In this case,
2110-
* the number of returned fields is the absolute value of the specified count.
2107+
* Return a random field from the hash along with its value stored at {@code key}. If the provided {@code count}
2108+
* argument is positive, return a list of distinct fields, capped either at {@code count} or the hash size. If
2109+
* {@code count} is negative, the behavior changes and the command is allowed to return the same field multiple times.
2110+
* In this case, the number of returned fields is the absolute value of the specified count.
21112111
*
21122112
* @param key must not be {@literal null}.
21132113
* @param count number of fields to return.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
8989
Double increment(HK key, double delta);
9090

9191
/**
92-
* Return a random key (aka field) from the hash value stored at the bound key.
92+
* Return a random key (aka field) from the hash stored at the bound key.
9393
*
9494
* @return {@literal null} if the hash does not exist or when used in pipeline / transaction.
9595
* @since 2.6
@@ -99,7 +99,7 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
9999
HK randomKey();
100100

101101
/**
102-
* Return a random entry from the hash value stored at the bound key.
102+
* Return a random entry from the hash stored at the bound key.
103103
*
104104
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
105105
* @since 2.6
@@ -109,10 +109,10 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
109109
Map.Entry<HK, HV> randomEntry();
110110

111111
/**
112-
* Return a random keys (aka fields) from the hash value stored at the bound key. If the provided {@code count} argument is
112+
* Return a random keys (aka fields) from the hash stored at the bound key. If the provided {@code count} argument is
113113
* positive, return a list of distinct keys, capped either at {@code count} or the hash size. If {@code count} is
114-
* negative, the behavior changes and the command is allowed to return the same key multiple times. In this case,
115-
* the number of returned keys is the absolute value of the specified count.
114+
* negative, the behavior changes and the command is allowed to return the same key multiple times. In this case, the
115+
* number of returned keys is the absolute value of the specified count.
116116
*
117117
* @param count number of keys to return.
118118
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -123,7 +123,7 @@ public interface BoundHashOperations<H, HK, HV> extends BoundKeyOperations<H> {
123123
List<HK> randomKeys(long count);
124124

125125
/**
126-
* Return a random entry from the hash value stored at the bound key.
126+
* Return a random entry from the hash stored at the bound key.
127127
*
128128
* @param count number of entries to return. Must be positive.
129129
* @return {@literal null} if the hash does not exist or when used in pipeline / transaction.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public interface HashOperations<H, HK, HV> {
8989
Double increment(H key, HK hashKey, double delta);
9090

9191
/**
92-
* Return a random hash key (aka field) from the hash value stored at {@code key}.
92+
* Return a random hash key (aka field) from the hash stored at {@code key}.
9393
*
9494
* @param key must not be {@literal null}.
9595
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -100,7 +100,7 @@ public interface HashOperations<H, HK, HV> {
100100
HK randomKey(H key);
101101

102102
/**
103-
* Return a random entry from the hash value stored at {@code key}.
103+
* Return a random entry from the hash stored at {@code key}.
104104
*
105105
* @param key must not be {@literal null}.
106106
* @return {@literal null} if key does not exist or when used in pipeline / transaction.
@@ -111,7 +111,7 @@ public interface HashOperations<H, HK, HV> {
111111
Map.Entry<HK, HV> randomEntry(H key);
112112

113113
/**
114-
* Return random hash keys (aka fields) from the hash value stored at {@code key}. If the provided {@code count} argument is
114+
* Return random hash keys (aka fields) from the hash stored at {@code key}. If the provided {@code count} argument is
115115
* positive, return a list of distinct hash keys, capped either at {@code count} or the hash size. If {@code count} is
116116
* negative, the behavior changes and the command is allowed to return the same hash key multiple times. In this case,
117117
* the number of returned fields is the absolute value of the specified count.
@@ -126,7 +126,7 @@ public interface HashOperations<H, HK, HV> {
126126
List<HK> randomKeys(H key, long count);
127127

128128
/**
129-
* Return a random entries from the hash value stored at {@code key}.
129+
* Return a random entries from the hash stored at {@code key}.
130130
*
131131
* @param key must not be {@literal null}.
132132
* @param count number of fields to return. Must be positive.

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public interface ReactiveHashOperations<H, HK, HV> {
8888
Mono<Double> increment(H key, HK hashKey, double delta);
8989

9090
/**
91-
* Return a random hash key (aka field) from the hash value stored at {@code key}.
91+
* Return a random hash key (aka field) from the hash stored at {@code key}.
9292
*
9393
* @param key must not be {@literal null}.
9494
* @return
@@ -98,7 +98,7 @@ public interface ReactiveHashOperations<H, HK, HV> {
9898
Mono<HK> randomKey(H key);
9999

100100
/**
101-
* Return a random entry from the hash value stored at {@code key}.
101+
* Return a random entry from the hash stored at {@code key}.
102102
*
103103
* @param key must not be {@literal null}.
104104
* @return
@@ -108,7 +108,7 @@ public interface ReactiveHashOperations<H, HK, HV> {
108108
Mono<Map.Entry<HK, HV>> randomEntry(H key);
109109

110110
/**
111-
* Return random hash keys (aka fields) from the hash value stored at {@code key}. If the provided {@code count} argument is
111+
* Return random hash keys (aka fields) from the hash stored at {@code key}. If the provided {@code count} argument is
112112
* positive, return a list of distinct hash keys, capped either at {@code count} or the hash size. If {@code count} is
113113
* negative, the behavior changes and the command is allowed to return the same hash key multiple times. In this case,
114114
* the number of returned fields is the absolute value of the specified count.

0 commit comments

Comments
 (0)