@@ -69,6 +69,14 @@ public class ReactiveRedisTemplate<K, V> implements ReactiveRedisOperations<K, V
6969 private final RedisSerializationContext <K , V > serializationContext ;
7070 private final boolean exposeConnection ;
7171 private final ReactiveScriptExecutor <K > reactiveScriptExecutor ;
72+ private final ReactiveGeoOperations <K , V > geoOps ;
73+ private final ReactiveHashOperations <K , ?, ?> hashOps ;
74+ private final ReactiveHyperLogLogOperations <K , V > hllOps ;
75+ private final ReactiveListOperations <K , V > listOps ;
76+ private final ReactiveSetOperations <K , V > setOps ;
77+ private final ReactiveStreamOperations <K , ?, ?> streamOps ;
78+ private final ReactiveValueOperations <K , V > valueOps ;
79+ private final ReactiveZSetOperations <K , V > zsetOps ;
7280
7381 /**
7482 * Creates new {@link ReactiveRedisTemplate} using given {@link ReactiveRedisConnectionFactory} and
@@ -100,6 +108,15 @@ public ReactiveRedisTemplate(ReactiveRedisConnectionFactory connectionFactory,
100108 this .serializationContext = serializationContext ;
101109 this .exposeConnection = exposeConnection ;
102110 this .reactiveScriptExecutor = new DefaultReactiveScriptExecutor <>(connectionFactory , serializationContext );
111+
112+ this .geoOps = opsForGeo (serializationContext );
113+ this .hashOps = opsForHash (serializationContext );
114+ this .hllOps = opsForHyperLogLog (serializationContext );
115+ this .listOps = opsForList (serializationContext );
116+ this .setOps = opsForSet (serializationContext );
117+ this .streamOps = opsForStream (serializationContext );
118+ this .valueOps = opsForValue (serializationContext );
119+ this .zsetOps = opsForZSet (serializationContext );
103120 }
104121
105122 /**
@@ -343,7 +360,7 @@ public Mono<Long> delete(Publisher<K> keys) {
343360 return createFlux (connection -> connection .keyCommands () //
344361 .mDel (Flux .from (keys ).map (this ::rawKey ).buffer (128 )) //
345362 .map (CommandResponse ::getOutput )) //
346- .collect (Collectors .summingLong (value -> value ));
363+ .collect (Collectors .summingLong (value -> value ));
347364 }
348365
349366 /*
@@ -378,7 +395,7 @@ public Mono<Long> unlink(Publisher<K> keys) {
378395 return createFlux (connection -> connection .keyCommands () //
379396 .mUnlink (Flux .from (keys ).map (this ::rawKey ).buffer (128 )) //
380397 .map (CommandResponse ::getOutput )) //
381- .collect (Collectors .summingLong (value -> value ));
398+ .collect (Collectors .summingLong (value -> value ));
382399 }
383400
384401 /*
@@ -530,7 +547,7 @@ protected ReactiveRedisConnection createRedisConnectionProxy(ReactiveRedisConnec
530547 */
531548 @ Override
532549 public ReactiveGeoOperations <K , V > opsForGeo () {
533- return opsForGeo ( serializationContext ) ;
550+ return geoOps ;
534551 }
535552
536553 /*
@@ -547,8 +564,9 @@ public <K1, V1> ReactiveGeoOperations<K1, V1> opsForGeo(RedisSerializationContex
547564 * @see org.springframework.data.redis.core.ReactiveRedisOperations#opsForHash()
548565 */
549566 @ Override
567+ @ SuppressWarnings ("unchecked" )
550568 public <HK , HV > ReactiveHashOperations <K , HK , HV > opsForHash () {
551- return opsForHash ( serializationContext ) ;
569+ return ( ReactiveHashOperations < K , HK , HV >) hashOps ;
552570 }
553571
554572 /*
@@ -567,7 +585,7 @@ public <K1, HK, HV> ReactiveHashOperations<K1, HK, HV> opsForHash(
567585 */
568586 @ Override
569587 public ReactiveHyperLogLogOperations <K , V > opsForHyperLogLog () {
570- return opsForHyperLogLog ( serializationContext ) ;
588+ return hllOps ;
571589 }
572590
573591 /*
@@ -586,7 +604,7 @@ public <K1, V1> ReactiveHyperLogLogOperations<K1, V1> opsForHyperLogLog(
586604 */
587605 @ Override
588606 public ReactiveListOperations <K , V > opsForList () {
589- return opsForList ( serializationContext ) ;
607+ return listOps ;
590608 }
591609
592610 /*
@@ -604,7 +622,7 @@ public <K1, V1> ReactiveListOperations<K1, V1> opsForList(RedisSerializationCont
604622 */
605623 @ Override
606624 public ReactiveSetOperations <K , V > opsForSet () {
607- return opsForSet ( serializationContext ) ;
625+ return setOps ;
608626 }
609627
610628 /*
@@ -621,16 +639,18 @@ public <K1, V1> ReactiveSetOperations<K1, V1> opsForSet(RedisSerializationContex
621639 * @see org.springframework.data.redis.core.ReactiveRedisOperations#opsForStream()
622640 */
623641 @ Override
642+ @ SuppressWarnings ("unchecked" )
624643 public <HK , HV > ReactiveStreamOperations <K , HK , HV > opsForStream () {
625- return opsForStream ( serializationContext ) ;
644+ return ( ReactiveStreamOperations < K , HK , HV >) streamOps ;
626645 }
627646
628647 /*
629648 * (non-Javadoc)
630649 * @see org.springframework.data.redis.core.ReactiveRedisOperations#opsForStream(HashMapper)
631650 */
632651 @ Override
633- public <HK , HV > ReactiveStreamOperations <K , HK , HV > opsForStream (HashMapper <? super K , ? super HK , ? super HV > hashMapper ) {
652+ public <HK , HV > ReactiveStreamOperations <K , HK , HV > opsForStream (
653+ HashMapper <? super K , ? super HK , ? super HV > hashMapper ) {
634654 return opsForStream (serializationContext , hashMapper );
635655 }
636656
@@ -645,7 +665,8 @@ public <HK, HV> ReactiveStreamOperations<K, HK, HV> opsForStream(
645665 }
646666
647667 protected <HK , HV > ReactiveStreamOperations <K , HK , HV > opsForStream (
648- RedisSerializationContext <K , ?> serializationContext , @ Nullable HashMapper <? super K , ? super HK , ? super HV > hashMapper ) {
668+ RedisSerializationContext <K , ?> serializationContext ,
669+ @ Nullable HashMapper <? super K , ? super HK , ? super HV > hashMapper ) {
649670 return new DefaultReactiveStreamOperations <>(this , serializationContext , hashMapper );
650671 }
651672
@@ -655,7 +676,7 @@ protected <HK, HV> ReactiveStreamOperations<K, HK, HV> opsForStream(
655676 */
656677 @ Override
657678 public ReactiveValueOperations <K , V > opsForValue () {
658- return opsForValue ( serializationContext ) ;
679+ return valueOps ;
659680 }
660681
661682 /*
@@ -673,7 +694,7 @@ public <K1, V1> ReactiveValueOperations<K1, V1> opsForValue(RedisSerializationCo
673694 */
674695 @ Override
675696 public ReactiveZSetOperations <K , V > opsForZSet () {
676- return opsForZSet ( serializationContext ) ;
697+ return zsetOps ;
677698 }
678699
679700 /*
0 commit comments