Spring Cache + Redis caching patterns for Kotlin. Use when implementing caching strategies, cache invalidation, TTL management, or Redis integration in multi-module projects.
domain → CachePort 인터페이스 정의 (선택)
infra → Redis 설정, @Cacheable 구현, CachePort 구현
app-api → 캐시 적용 대상 결정 (Application Service)
// infra 모듈
@ConfigurationProperties(prefix = "cache")
data class CacheProperties(
val defaultTtl: Duration = Duration.ofMinutes(30),
val configs: Map<String, CacheConfig> = emptyMap()
) {
data class CacheConfig(
val ttl: Duration,
val maxSize: Long = 1000
)
}