@@ -65,6 +65,13 @@ public class ReactiveRedisTemplate<K, V> implements ReactiveRedisOperations<K, V
65
65
private final RedisSerializationContext <K , V > serializationContext ;
66
66
private final boolean exposeConnection ;
67
67
private final ReactiveScriptExecutor <K > reactiveScriptExecutor ;
68
+ private final ReactiveGeoOperations <K , V > geoOps ;
69
+ private final ReactiveHashOperations <K , ?, ?> hashOps ;
70
+ private final ReactiveHyperLogLogOperations <K , V > hllOps ;
71
+ private final ReactiveListOperations <K , V > listOps ;
72
+ private final ReactiveSetOperations <K , V > setOps ;
73
+ private final ReactiveValueOperations <K , V > valueOps ;
74
+ private final ReactiveZSetOperations <K , V > zsetOps ;
68
75
69
76
/**
70
77
* Creates new {@link ReactiveRedisTemplate} using given {@link ReactiveRedisConnectionFactory} and
@@ -96,6 +103,14 @@ public ReactiveRedisTemplate(ReactiveRedisConnectionFactory connectionFactory,
96
103
this .serializationContext = serializationContext ;
97
104
this .exposeConnection = exposeConnection ;
98
105
this .reactiveScriptExecutor = new DefaultReactiveScriptExecutor <>(connectionFactory , serializationContext );
106
+
107
+ this .geoOps = opsForGeo (serializationContext );
108
+ this .hashOps = opsForHash (serializationContext );
109
+ this .hllOps = opsForHyperLogLog (serializationContext );
110
+ this .listOps = opsForList (serializationContext );
111
+ this .setOps = opsForSet (serializationContext );
112
+ this .valueOps = opsForValue (serializationContext );
113
+ this .zsetOps = opsForZSet (serializationContext );
99
114
}
100
115
101
116
/**
@@ -350,7 +365,7 @@ public Mono<Long> delete(Publisher<K> keys) {
350
365
return createFlux (connection -> connection .keyCommands () //
351
366
.mDel (Flux .from (keys ).map (this ::rawKey ).buffer (128 )) //
352
367
.map (CommandResponse ::getOutput )) //
353
- .collect (Collectors .summingLong (value -> value ));
368
+ .collect (Collectors .summingLong (value -> value ));
354
369
}
355
370
356
371
/*
@@ -385,7 +400,7 @@ public Mono<Long> unlink(Publisher<K> keys) {
385
400
return createFlux (connection -> connection .keyCommands () //
386
401
.mUnlink (Flux .from (keys ).map (this ::rawKey ).buffer (128 )) //
387
402
.map (CommandResponse ::getOutput )) //
388
- .collect (Collectors .summingLong (value -> value ));
403
+ .collect (Collectors .summingLong (value -> value ));
389
404
}
390
405
391
406
/*
@@ -537,7 +552,7 @@ protected ReactiveRedisConnection createRedisConnectionProxy(ReactiveRedisConnec
537
552
*/
538
553
@ Override
539
554
public ReactiveGeoOperations <K , V > opsForGeo () {
540
- return opsForGeo ( serializationContext ) ;
555
+ return geoOps ;
541
556
}
542
557
543
558
/*
@@ -554,8 +569,9 @@ public <K1, V1> ReactiveGeoOperations<K1, V1> opsForGeo(RedisSerializationContex
554
569
* @see org.springframework.data.redis.core.ReactiveRedisOperations#opsForHash()
555
570
*/
556
571
@ Override
572
+ @ SuppressWarnings ("unchecked" )
557
573
public <HK , HV > ReactiveHashOperations <K , HK , HV > opsForHash () {
558
- return opsForHash ( serializationContext ) ;
574
+ return ( ReactiveHashOperations < K , HK , HV >) hashOps ;
559
575
}
560
576
561
577
/*
@@ -574,7 +590,7 @@ public <K1, HK, HV> ReactiveHashOperations<K1, HK, HV> opsForHash(
574
590
*/
575
591
@ Override
576
592
public ReactiveHyperLogLogOperations <K , V > opsForHyperLogLog () {
577
- return opsForHyperLogLog ( serializationContext ) ;
593
+ return hllOps ;
578
594
}
579
595
580
596
/*
@@ -593,7 +609,7 @@ public <K1, V1> ReactiveHyperLogLogOperations<K1, V1> opsForHyperLogLog(
593
609
*/
594
610
@ Override
595
611
public ReactiveListOperations <K , V > opsForList () {
596
- return opsForList ( serializationContext ) ;
612
+ return listOps ;
597
613
}
598
614
599
615
/*
@@ -611,7 +627,7 @@ public <K1, V1> ReactiveListOperations<K1, V1> opsForList(RedisSerializationCont
611
627
*/
612
628
@ Override
613
629
public ReactiveSetOperations <K , V > opsForSet () {
614
- return opsForSet ( serializationContext ) ;
630
+ return setOps ;
615
631
}
616
632
617
633
/*
@@ -629,7 +645,7 @@ public <K1, V1> ReactiveSetOperations<K1, V1> opsForSet(RedisSerializationContex
629
645
*/
630
646
@ Override
631
647
public ReactiveValueOperations <K , V > opsForValue () {
632
- return opsForValue ( serializationContext ) ;
648
+ return valueOps ;
633
649
}
634
650
635
651
/*
@@ -647,7 +663,7 @@ public <K1, V1> ReactiveValueOperations<K1, V1> opsForValue(RedisSerializationCo
647
663
*/
648
664
@ Override
649
665
public ReactiveZSetOperations <K , V > opsForZSet () {
650
- return opsForZSet ( serializationContext ) ;
666
+ return zsetOps ;
651
667
}
652
668
653
669
/*
0 commit comments