Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
= Redis 설정
|
||||
|
||||
== RedisConfig
|
||||
SDL은 어플리케이션 속도 향상을 위해 자주 사용하는 Data를 Cache하고 있다.
|
||||
기본적으로 Local, Dev 환경에서는 Spring에서 제공하고 있는 ConcurrentMapCacheManager를 사용해
|
||||
Data를 Cache하고 있지만 Clustering 환경에서 Cache Replicated를 위해서
|
||||
Redis를 사용한다.
|
||||
|
||||
IMPORTANT: Ehcache 3부터 RMI, JMS 방식이 Cache 동기화 지원이 중단 됐으니 Cache 복제가 필요한 경우 Redis를 반드시 사용해야 한다.
|
||||
|
||||
application.properties
|
||||
----
|
||||
spring.cache.type=redis
|
||||
spring.data.redis.host=redis 서버 주소
|
||||
spring.data.redis.port=redis 포트
|
||||
----
|
||||
|
||||
RedisConfig
|
||||
----
|
||||
@Bean
|
||||
public RedisCacheManagerBuilderCustomizer redisCacheManagerBuilderCustomizer() {
|
||||
return (builder) -> builder
|
||||
.withCacheConfiguration("message-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("message",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("menu-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("menu-label-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("menu-full-path-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("page-full-path-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("api-full-path-all",
|
||||
RedisCacheConfiguration.defaultCacheConfig())
|
||||
.withCacheConfiguration("api-user",
|
||||
RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(300)))
|
||||
.withCacheConfiguration("api-user-menu",
|
||||
RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofSeconds(300)))
|
||||
.withCacheConfiguration("page-all-by-menu-auth",
|
||||
RedisCacheConfiguration.defaultCacheConfig());
|
||||
}
|
||||
----
|
||||
|
||||
각 Cache별 필요한 세팅은 redisCacheManagerBuilderCustomizer 메소드에서 할수 있으니 시스템 환경에 맞춰 적절하게 수정한다.
|
||||
Reference in New Issue
Block a user