콘텐츠 메인 캐싱전략 수정 #67

Merged
klaus merged 1 commits from test into main 2023-11-06 08:46:55 +00:00
4 changed files with 6 additions and 13 deletions

View File

@ -400,8 +400,6 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
return queryFactory
.selectFrom(audioContentCuration)
.where(where)
.offset(0)
.limit(15)
.orderBy(audioContentCuration.orders.asc())
.fetch()
}

View File

@ -20,7 +20,7 @@ class AudioContentMainController(private val service: AudioContentMainService) {
) = run {
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
ApiResponse.ok(service.getMain(member = member))
ApiResponse.ok(service.getMain(memberId = member.id!!, isAdult = member.auth != null))
}
@GetMapping("/new")

View File

@ -29,10 +29,8 @@ class AudioContentMainService(
@Value("\${cloud.aws.cloud-front.host}")
private val imageHost: String
) {
fun getMain(member: Member): GetAudioContentMainResponse {
val isAdult = member.auth != null
val memberId = member.id!!
@Cacheable(cacheNames = ["default"], key = "'contentMain:' + #memberId + ':' + #isAdult")
fun getMain(memberId: Long, isAdult: Boolean): GetAudioContentMainResponse {
// 2주일 이내에 콘텐츠를 올린 크리에이터 20명 조회
val newContentUploadCreatorList = getNewContentUploadCreatorList(memberId = memberId, isAdult = isAdult)
@ -40,7 +38,7 @@ class AudioContentMainService(
// 구매목록 20개
val orderList = orderService.getAudioContentMainOrderList(
member = member,
memberId = memberId,
limit = 20
)
@ -118,7 +116,6 @@ class AudioContentMainService(
return GetNewContentAllResponse(totalCount, items)
}
@Cacheable(cacheNames = ["default"], key = "'newContentUploadCreatorList:' + #memberId + ':' + #isAdult")
fun getNewContentUploadCreatorList(memberId: Long, isAdult: Boolean): List<GetNewContentUploadCreator> {
return repository.getNewContentUploadCreatorList(
cloudfrontHost = imageHost,
@ -129,7 +126,6 @@ class AudioContentMainService(
.toList()
}
@Cacheable(cacheNames = ["default"], key = "'contentMainBannerList:' + #memberId + ':' + #isAdult")
fun getAudioContentMainBannerList(memberId: Long, isAdult: Boolean) =
repository.getAudioContentMainBannerList(isAdult = isAdult)
.asSequence()
@ -178,7 +174,6 @@ class AudioContentMainService(
}
.toList()
@Cacheable(cacheNames = ["default"], key = "'contentCurationList:' + #memberId + ':' + #isAdult")
fun getAudioContentCurationList(memberId: Long, isAdult: Boolean) =
repository.getAudioContentCurations(isAdult = isAdult)
.asSequence()

View File

@ -92,11 +92,11 @@ class OrderService(
)
}
fun getAudioContentMainOrderList(member: Member, limit: Int): List<GetAudioContentMainItem> {
fun getAudioContentMainOrderList(memberId: Long, limit: Int): List<GetAudioContentMainItem> {
return repository.getAudioContentMainOrderList(
dateTime = LocalDateTime.now(),
coverImageHost = audioContentCoverImageHost,
memberId = member.id!!,
memberId = memberId,
offset = 0,
limit = 20
)