15
15
*/
16
16
package org .springframework .data .redis .core ;
17
17
18
- import org .springframework .data .redis .connection .convert .Converters ;
19
18
import reactor .core .publisher .Flux ;
20
19
import reactor .core .publisher .Mono ;
21
20
22
21
import java .nio .ByteBuffer ;
23
22
import java .util .ArrayList ;
24
23
import java .util .Collection ;
25
- import java .util .Collections ;
26
24
import java .util .List ;
27
25
import java .util .Map ;
28
26
import java .util .function .Function ;
29
27
30
28
import org .reactivestreams .Publisher ;
29
+
31
30
import org .springframework .data .redis .connection .ReactiveHashCommands ;
31
+ import org .springframework .data .redis .connection .convert .Converters ;
32
32
import org .springframework .data .redis .serializer .RedisSerializationContext ;
33
33
import org .springframework .util .Assert ;
34
34
@@ -125,7 +125,7 @@ public Mono<Long> increment(H key, HK hashKey, long delta) {
125
125
Assert .notNull (key , "Key must not be null!" );
126
126
Assert .notNull (hashKey , "Hash key must not be null!" );
127
127
128
- return template .createMono (connection -> connection //
128
+ return template .doCreateMono (connection -> connection //
129
129
.numberCommands () //
130
130
.hIncrBy (rawKey (key ), rawHashKey (hashKey ), delta ));
131
131
}
@@ -140,7 +140,7 @@ public Mono<Double> increment(H key, HK hashKey, double delta) {
140
140
Assert .notNull (key , "Key must not be null!" );
141
141
Assert .notNull (hashKey , "Hash key must not be null!" );
142
142
143
- return template .createMono (connection -> connection //
143
+ return template .doCreateMono (connection -> connection //
144
144
.numberCommands () //
145
145
.hIncrBy (rawKey (key ), rawHashKey (hashKey ), delta ));
146
146
}
@@ -154,7 +154,7 @@ public Mono<HK> randomKey(H key) {
154
154
155
155
Assert .notNull (key , "Key must not be null!" );
156
156
157
- return template .createMono (connection -> connection //
157
+ return template .doCreateMono (connection -> connection //
158
158
.hashCommands ().hRandField (rawKey (key ))).map (this ::readHashKey );
159
159
}
160
160
@@ -167,7 +167,7 @@ public Mono<Map.Entry<HK, HV>> randomEntry(H key) {
167
167
168
168
Assert .notNull (key , "Key must not be null!" );
169
169
170
- return template .createMono (connection -> connection //
170
+ return template .doCreateMono (connection -> connection //
171
171
.hashCommands ().hRandFieldWithValues (rawKey (key ))).map (this ::deserializeHashEntry );
172
172
}
173
173
@@ -180,7 +180,7 @@ public Flux<HK> randomKeys(H key, long count) {
180
180
181
181
Assert .notNull (key , "Key must not be null!" );
182
182
183
- return template .createFlux (connection -> connection //
183
+ return template .doCreateFlux (connection -> connection //
184
184
.hashCommands ().hRandField (rawKey (key ), count )).map (this ::readHashKey );
185
185
}
186
186
@@ -193,7 +193,7 @@ public Flux<Map.Entry<HK, HV>> randomEntries(H key, long count) {
193
193
194
194
Assert .notNull (key , "Key must not be null!" );
195
195
196
- return template .createFlux (connection -> connection //
196
+ return template .doCreateFlux (connection -> connection //
197
197
.hashCommands ().hRandFieldWithValues (rawKey (key ), count )).map (this ::deserializeHashEntry );
198
198
}
199
199
@@ -314,21 +314,21 @@ public Mono<Boolean> delete(H key) {
314
314
315
315
Assert .notNull (key , "Key must not be null!" );
316
316
317
- return template .createMono (connection -> connection .keyCommands ().del (rawKey (key ))).map (l -> l != 0 );
317
+ return template .doCreateMono (connection -> connection .keyCommands ().del (rawKey (key ))).map (l -> l != 0 );
318
318
}
319
319
320
320
private <T > Mono <T > createMono (Function <ReactiveHashCommands , Publisher <T >> function ) {
321
321
322
322
Assert .notNull (function , "Function must not be null!" );
323
323
324
- return template .createMono (connection -> function .apply (connection .hashCommands ()));
324
+ return template .doCreateMono (connection -> function .apply (connection .hashCommands ()));
325
325
}
326
326
327
327
private <T > Flux <T > createFlux (Function <ReactiveHashCommands , Publisher <T >> function ) {
328
328
329
329
Assert .notNull (function , "Function must not be null!" );
330
330
331
- return template .createFlux (connection -> function .apply (connection .hashCommands ()));
331
+ return template .doCreateFlux (connection -> function .apply (connection .hashCommands ()));
332
332
}
333
333
334
334
private ByteBuffer rawKey (H key ) {
0 commit comments