Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
musab.bozkurt committed Feb 4, 2024
1 parent 4322ea0 commit df2d4f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions src/main/java/com/mb/livedataservice/config/CacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@
@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
public class CacheConfig {

@Bean(name = "cacheManager")
@ConditionalOnMissingBean(name = "cacheManager")
public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
RedisCacheConfiguration expireIn1Day = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofDays(1));

Map<String, RedisCacheConfiguration> cacheConfigurations = new HashMap<>();

cacheConfigurations.put(RedisConstants.CACHE_KEY, expireIn1Day);

return RedisCacheManager.RedisCacheManagerBuilder
.fromConnectionFactory(connectionFactory)
.withInitialCacheConfigurations(cacheConfigurations)
.build();
}

/*
* If the Redis client is protected, add this config bean. Otherwise, this bean can be removed.
*
Expand All @@ -58,4 +43,19 @@ public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory)
public static ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP;
}

@Bean(name = "cacheManager")
@ConditionalOnMissingBean(name = "cacheManager")
public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
RedisCacheConfiguration expireIn1Day = RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofDays(1));

Map<String, RedisCacheConfiguration> cacheConfigurations = new HashMap<>();

cacheConfigurations.put(RedisConstants.CACHE_KEY, expireIn1Day);

return RedisCacheManager.RedisCacheManagerBuilder
.fromConnectionFactory(connectionFactory)
.withInitialCacheConfigurations(cacheConfigurations)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class TutorialControllerTest extends BaseUnitTest {

@Container
@ServiceConnection
private static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.1");
public static final GenericContainer redis = new GenericContainer(DockerImageName.parse("redis:7.2.4")).withExposedPorts(6379);

@Container
@ServiceConnection
public static final GenericContainer redis = new GenericContainer(DockerImageName.parse("redis:7.2.4")).withExposedPorts(6379);
public static final KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.5.3"));

@Container
@ServiceConnection
public static final KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.5.3"));
private static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.1");

@Autowired
private TestRestTemplate restTemplate;
Expand Down

0 comments on commit df2d4f3

Please sign in to comment.