Merge pull request '콘텐츠 메인 API - @Transactional(readOnly = true) 추가' (#70) from test into main

Reviewed-on: #70
This commit is contained in:
klaus 2023-11-07 08:47:47 +00:00
commit 3c8e72073c
4 changed files with 9 additions and 0 deletions

View File

@ -577,6 +577,7 @@ class AudioContentService(
}
}
@Transactional(readOnly = true)
@Cacheable(
cacheNames = ["cache_ttl_3_days"],
key = "'contentRanking:' + ':' +" +

View File

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value
import org.springframework.cache.annotation.Cacheable
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.time.DayOfWeek
import java.time.LocalDateTime
import java.time.temporal.TemporalAdjusters
@ -29,6 +30,7 @@ class AudioContentMainService(
@Value("\${cloud.aws.cloud-front.host}")
private val imageHost: String
) {
@Transactional(readOnly = true)
fun getMain(memberId: Long, isAdult: Boolean): GetAudioContentMainResponse {
// 2주일 이내에 콘텐츠를 올린 크리에이터 20명 조회
val newContentUploadCreatorList = getNewContentUploadCreatorList(memberId = memberId, isAdult = isAdult)
@ -120,6 +122,7 @@ class AudioContentMainService(
return GetNewContentAllResponse(totalCount, items)
}
@Transactional(readOnly = true)
@Cacheable(cacheNames = ["default"], key = "'newContentUploadCreatorList:' + #memberId + ':' + #isAdult")
fun getNewContentUploadCreatorList(memberId: Long, isAdult: Boolean): List<GetNewContentUploadCreator> {
return repository.getNewContentUploadCreatorList(
@ -131,6 +134,7 @@ class AudioContentMainService(
.toList()
}
@Transactional(readOnly = true)
@Cacheable(cacheNames = ["default"], key = "'contentMainBannerList:' + #memberId + ':' + #isAdult")
fun getAudioContentMainBannerList(memberId: Long, isAdult: Boolean) =
repository.getAudioContentMainBannerList(isAdult = isAdult)
@ -180,6 +184,7 @@ class AudioContentMainService(
}
.toList()
@Transactional(readOnly = true)
@Cacheable(cacheNames = ["default"], key = "'contentCurationList:' + #memberId + ':' + #isAdult")
fun getAudioContentCurationList(memberId: Long, isAdult: Boolean) =
repository.getAudioContentCurations(isAdult = isAdult)

View File

@ -92,6 +92,7 @@ class OrderService(
)
}
@Transactional(readOnly = true)
fun getAudioContentMainOrderList(memberId: Long, limit: Int): List<GetAudioContentMainItem> {
return repository.getAudioContentMainOrderList(
dateTime = LocalDateTime.now(),

View File

@ -6,6 +6,7 @@ import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentThe
import org.springframework.beans.factory.annotation.Value
import org.springframework.cache.annotation.Cacheable
import org.springframework.stereotype.Repository
import org.springframework.transaction.annotation.Transactional
@Repository
class AudioContentThemeQueryRepository(
@ -28,6 +29,7 @@ class AudioContentThemeQueryRepository(
.fetch()
}
@Transactional(readOnly = true)
@Cacheable(cacheNames = ["default"], key = "'activeThemeOfContent:' + ':' + #isAdult")
fun getActiveThemeOfContent(isAdult: Boolean = false): List<String> {
var where = audioContent.isActive.isTrue