From e5c85287bbc0b5e2188e28b19c79215fdeef8b3e Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 17 Oct 2023 17:58:24 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BA=90=EC=8B=9C=20=EC=A0=81=EC=9A=A9=20-=20?= =?UTF-8?q?=EC=B6=94=EC=B2=9C=EB=9D=BC=EC=9D=B4=EB=B8=8C,=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EB=A6=AC=EC=8A=A4=ED=8A=B8,=202=EC=A3=BC?= =?UTF-8?q?=20=EC=9D=B4=EB=82=B4=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=ED=95=9C=20=ED=81=AC=EB=A6=AC=EC=97=90?= =?UTF-8?q?=EC=9D=B4=ED=84=B0,=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=83=81?= =?UTF-8?q?=EB=8B=A8=20=EB=B0=B0=EB=84=88,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kr/co/vividnext/sodalive/configs/RedisConfig.kt | 4 ++-- .../vividnext/sodalive/content/AudioContentRepository.kt | 8 ++++++++ .../kotlin/kr/co/vividnext/sodalive/event/EventService.kt | 5 +++++ .../sodalive/live/recommend/LiveRecommendRepository.kt | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/configs/RedisConfig.kt b/src/main/kotlin/kr/co/vividnext/sodalive/configs/RedisConfig.kt index 0ec3965..f309011 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/configs/RedisConfig.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/configs/RedisConfig.kt @@ -39,7 +39,7 @@ class RedisConfig( @Bean fun cacheManager(connectionFactory: RedisConnectionFactory): RedisCacheManager { val defaultConfig = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(Duration.ofMinutes(10)) // Default TTL + .entryTtl(Duration.ofHours(1)) // Default TTL .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) .serializeValuesWith( RedisSerializationContext.SerializationPair.fromSerializer( @@ -48,7 +48,7 @@ class RedisConfig( ) val weekLivedCacheConfig = RedisCacheConfiguration.defaultCacheConfig() - .entryTtl(Duration.ofDays(7)) + .entryTtl(Duration.ofDays(3)) .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) .serializeValuesWith( RedisSerializationContext.SerializationPair.fromSerializer( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index bbed90d..862f272 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -337,6 +337,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) .fetch() } + @Cacheable( + value = ["getNewContentUploadCreatorList"], + cacheManager = "cacheManager" + ) override fun getNewContentUploadCreatorList( cloudfrontHost: String, isAdult: Boolean @@ -372,6 +376,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) .toList() } + @Cacheable( + value = ["getAudioContentMainBannerList"], + cacheManager = "cacheManager" + ) override fun getAudioContentMainBannerList(isAdult: Boolean): List { var where = audioContentBanner.isActive.isTrue diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/event/EventService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/event/EventService.kt index e6ddd74..2237d7b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/event/EventService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/event/EventService.kt @@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.aws.s3.S3Uploader import kr.co.vividnext.sodalive.common.SodaException import kr.co.vividnext.sodalive.utils.generateFileName import org.springframework.beans.factory.annotation.Value +import org.springframework.cache.annotation.Cacheable import org.springframework.data.repository.findByIdOrNull import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -20,6 +21,10 @@ class EventService( @Value("\${cloud.aws.cloud-front.host}") private val cloudFrontHost: String ) { + @Cacheable( + value = ["getEventList"], + cacheManager = "cacheManager" + ) fun getEventList(): GetEventResponse { val eventList = repository.getEventList() .asSequence() diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/live/recommend/LiveRecommendRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/live/recommend/LiveRecommendRepository.kt index e6ece32..b65eecb 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/live/recommend/LiveRecommendRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/live/recommend/LiveRecommendRepository.kt @@ -9,6 +9,7 @@ import kr.co.vividnext.sodalive.member.MemberRole import kr.co.vividnext.sodalive.member.QMember.member import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing import org.springframework.beans.factory.annotation.Value +import org.springframework.cache.annotation.Cacheable import org.springframework.stereotype.Repository import java.time.LocalDateTime @@ -19,6 +20,10 @@ class LiveRecommendRepository( @Value("\${cloud.aws.cloud-front.host}") private val cloudFrontHost: String ) { + @Cacheable( + value = ["getRecommendLive"], + cacheManager = "cacheManager" + ) fun getRecommendLive( memberId: Long, isBlocked: (Long) -> Boolean,