Skip to content

Commit a140916

Browse files
committed
CacheOptionalTests updated
1 parent a62fbea commit a140916

File tree

2 files changed

+20
-35
lines changed

2 files changed

+20
-35
lines changed

cache/cache-annotation-processor/src/test/java/ru/tinkoff/kora/cache/annotation/processor/CacheOptionalTests.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void evictValue(String arg1) {
4040
compileResult.assertSuccess();
4141

4242
var cache = newObject("$DummyCacheImpl", CacheRunner.getCaffeineConfig(),
43-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
43+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
4444
assertThat(cache).isNotNull();
4545

4646
var service = newObject("$CacheableSync__AopProxy", cache);
@@ -83,10 +83,10 @@ public void evictValue(String arg1) {
8383
compileResult.assertSuccess();
8484

8585
var cache1 = newObject("$DummyCache1Impl", CacheRunner.getCaffeineConfig(),
86-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
86+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
8787
assertThat(cache1).isNotNull();
8888
var cache2 = newObject("$DummyCache2Impl", CacheRunner.getCaffeineConfig(),
89-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
89+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
9090
assertThat(cache2).isNotNull();
9191

9292
var service = newObject("$CacheableSync__AopProxy", cache1, cache2);
@@ -123,7 +123,7 @@ public void evictValue(String arg1) {
123123
compileResult.assertSuccess();
124124

125125
var cache = newObject("$DummyCacheImpl", CacheRunner.getCaffeineConfig(),
126-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
126+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
127127
assertThat(cache).isNotNull();
128128

129129
var service = newObject("$CacheableSync__AopProxy", cache);
@@ -166,10 +166,10 @@ public void evictValue(String arg1) {
166166
compileResult.assertSuccess();
167167

168168
var cache1 = newObject("$DummyCache1Impl", CacheRunner.getCaffeineConfig(),
169-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
169+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
170170
assertThat(cache1).isNotNull();
171171
var cache2 = newObject("$DummyCache2Impl", CacheRunner.getCaffeineConfig(),
172-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
172+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
173173
assertThat(cache2).isNotNull();
174174

175175
var service = newObject("$CacheableSync__AopProxy", cache1, cache2);
@@ -206,7 +206,7 @@ public void evictValue(String arg1) {
206206
compileResult.assertSuccess();
207207

208208
var cache = newObject("$DummyCacheImpl", CacheRunner.getCaffeineConfig(),
209-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
209+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
210210
assertThat(cache).isNotNull();
211211

212212
var service = newObject("$CacheableSync__AopProxy", cache);
@@ -249,10 +249,10 @@ public void evictValue(String arg1) {
249249
compileResult.assertSuccess();
250250

251251
var cache1 = newObject("$DummyCache1Impl", CacheRunner.getCaffeineConfig(),
252-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
252+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
253253
assertThat(cache1).isNotNull();
254254
var cache2 = newObject("$DummyCache2Impl", CacheRunner.getCaffeineConfig(),
255-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
255+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
256256
assertThat(cache2).isNotNull();
257257

258258
var service = newObject("$CacheableSync__AopProxy", cache1, cache2);
@@ -295,10 +295,10 @@ public void evictValue(String arg1) {
295295
compileResult.assertSuccess();
296296

297297
var cache1 = newObject("$DummyCache1Impl", CacheRunner.getCaffeineConfig(),
298-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
298+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
299299
assertThat(cache1).isNotNull();
300300
var cache2 = newObject("$DummyCache2Impl", CacheRunner.getCaffeineConfig(),
301-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
301+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
302302
assertThat(cache2).isNotNull();
303303

304304
var service = newObject("$CacheableSync__AopProxy", cache1, cache2);
@@ -341,10 +341,10 @@ public void evictValue(String arg1) {
341341
compileResult.assertSuccess();
342342

343343
var cache1 = newObject("$DummyCache1Impl", CacheRunner.getCaffeineConfig(),
344-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
344+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
345345
assertThat(cache1).isNotNull();
346346
var cache2 = newObject("$DummyCache2Impl", CacheRunner.getCaffeineConfig(),
347-
caffeineCacheFactory(null), caffeineCacheTelemetry(null, null));
347+
caffeineCacheFactory(null), defaultCacheTelemetryFactory(null, null, null));
348348
assertThat(cache2).isNotNull();
349349

350350
var service = newObject("$CacheableSync__AopProxy", cache1, cache2);

redis/redis-lettuce/src/main/java/ru/tinkoff/kora/redis/lettuce/LettuceModule.java

+7-22
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import io.lettuce.core.support.ConnectionPoolSupport;
1919
import org.apache.commons.pool2.ObjectPool;
2020
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
21-
import ru.tinkoff.kora.application.graph.TypeRef;
2221
import ru.tinkoff.kora.application.graph.Wrapped;
2322
import ru.tinkoff.kora.common.DefaultComponent;
2423
import ru.tinkoff.kora.config.common.Config;
@@ -70,17 +69,13 @@ default RedisCodec<Integer, Integer> lettuceRedisIntegerCodec() {
7069

7170
@DefaultComponent
7271
default <K, V> RedisCodec<K, V> lettuceRedisCompositeCodec(RedisCodec<K, K> keyCodec,
73-
RedisCodec<V, V> valueCodec,
74-
TypeRef<K> keyRef,
75-
TypeRef<V> valueRef) {
72+
RedisCodec<V, V> valueCodec) {
7673
return new LettuceCompositeRedisCodec<>(keyCodec, valueCodec);
7774
}
7875

7976
@DefaultComponent
8077
default <K, V> Wrapped<StatefulConnection<K, V>> lettuceStatefulConnection(AbstractRedisClient redisClient,
81-
RedisCodec<K, V> codec,
82-
TypeRef<K> keyRef,
83-
TypeRef<V> valueRef) {
78+
RedisCodec<K, V> codec) {
8479
if (redisClient instanceof io.lettuce.core.RedisClient rc) {
8580
return new LettuceLifecycleConnectionWrapper<>(() -> rc.connect(codec));
8681
} else if (redisClient instanceof RedisClusterClient rcc) {
@@ -93,9 +88,7 @@ default <K, V> Wrapped<StatefulConnection<K, V>> lettuceStatefulConnection(Abstr
9388
@DefaultComponent
9489
default <K, V> Wrapped<ObjectPool<StatefulConnection<K, V>>> lettuceSyncConnectionPool(AbstractRedisClient redisClient,
9590
LettuceConfig lettuceConfig,
96-
RedisCodec<K, V> codec,
97-
TypeRef<K> keyRef,
98-
TypeRef<V> valueRef) {
91+
RedisCodec<K, V> codec) {
9992
final GenericObjectPoolConfig<StatefulConnection<K, V>> poolConfig = new GenericObjectPoolConfig<>();
10093
poolConfig.setMaxTotal(lettuceConfig.pool().maxTotal());
10194
poolConfig.setMaxIdle(lettuceConfig.pool().maxIdle());
@@ -118,9 +111,7 @@ default <K, V> Wrapped<ObjectPool<StatefulConnection<K, V>>> lettuceSyncConnecti
118111
@DefaultComponent
119112
default <K, V> Wrapped<AsyncPool<StatefulConnection<K, V>>> lettuceAsyncConnectionPool(AbstractRedisClient redisClient,
120113
LettuceConfig lettuceConfig,
121-
RedisCodec<K, V> codec,
122-
TypeRef<K> keyRef,
123-
TypeRef<V> valueRef) {
114+
RedisCodec<K, V> codec) {
124115
final BoundedPoolConfig poolConfig = BoundedPoolConfig.builder()
125116
.maxTotal(lettuceConfig.pool().maxTotal())
126117
.maxIdle(lettuceConfig.pool().maxIdle())
@@ -142,9 +133,7 @@ default <K, V> Wrapped<AsyncPool<StatefulConnection<K, V>>> lettuceAsyncConnecti
142133
}
143134

144135
@DefaultComponent
145-
default <K, V> RedisClusterCommands<K, V> lettuceRedisClusterSyncCommands(StatefulConnection<K, V> connection,
146-
TypeRef<K> keyRef,
147-
TypeRef<V> valueRef) {
136+
default <K, V> RedisClusterCommands<K, V> lettuceRedisClusterSyncCommands(StatefulConnection<K, V> connection) {
148137
if (connection instanceof StatefulRedisConnection<K, V> rc) {
149138
return rc.sync();
150139
} else if (connection instanceof StatefulRedisClusterConnection<K, V> rcc) {
@@ -155,9 +144,7 @@ default <K, V> RedisClusterCommands<K, V> lettuceRedisClusterSyncCommands(Statef
155144
}
156145

157146
@DefaultComponent
158-
default <K, V> RedisClusterAsyncCommands<K, V> lettuceRedisClusterAsyncCommands(StatefulConnection<K, V> connection,
159-
TypeRef<K> keyRef,
160-
TypeRef<V> valueRef) {
147+
default <K, V> RedisClusterAsyncCommands<K, V> lettuceRedisClusterAsyncCommands(StatefulConnection<K, V> connection) {
161148
if (connection instanceof StatefulRedisConnection<K, V> rc) {
162149
return rc.async();
163150
} else if (connection instanceof StatefulRedisClusterConnection<K, V> rcc) {
@@ -168,9 +155,7 @@ default <K, V> RedisClusterAsyncCommands<K, V> lettuceRedisClusterAsyncCommands(
168155
}
169156

170157
@DefaultComponent
171-
default <K, V> RedisClusterReactiveCommands<K, V> lettuceRedisClusterReactiveCommands(StatefulConnection<K, V> connection,
172-
TypeRef<K> keyRef,
173-
TypeRef<V> valueRef) {
158+
default <K, V> RedisClusterReactiveCommands<K, V> lettuceRedisClusterReactiveCommands(StatefulConnection<K, V> connection) {
174159
if (connection instanceof StatefulRedisConnection<K, V> rc) {
175160
return rc.reactive();
176161
} else if (connection instanceof StatefulRedisClusterConnection<K, V> rcc) {

0 commit comments

Comments
 (0)