캐시 적용 - 추천라이브, 이벤트 리스트, 2주 이내 콘텐츠 업로드 한 크리에이터, 콘텐츠 상단 배너,
This commit is contained in:
parent
1fcb0ec5fd
commit
e5c85287bb
|
@ -39,7 +39,7 @@ class RedisConfig(
|
||||||
@Bean
|
@Bean
|
||||||
fun cacheManager(connectionFactory: RedisConnectionFactory): RedisCacheManager {
|
fun cacheManager(connectionFactory: RedisConnectionFactory): RedisCacheManager {
|
||||||
val defaultConfig = RedisCacheConfiguration.defaultCacheConfig()
|
val defaultConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
.entryTtl(Duration.ofMinutes(10)) // Default TTL
|
.entryTtl(Duration.ofHours(1)) // Default TTL
|
||||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer()))
|
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer()))
|
||||||
.serializeValuesWith(
|
.serializeValuesWith(
|
||||||
RedisSerializationContext.SerializationPair.fromSerializer(
|
RedisSerializationContext.SerializationPair.fromSerializer(
|
||||||
|
@ -48,7 +48,7 @@ class RedisConfig(
|
||||||
)
|
)
|
||||||
|
|
||||||
val weekLivedCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
val weekLivedCacheConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||||
.entryTtl(Duration.ofDays(7))
|
.entryTtl(Duration.ofDays(3))
|
||||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer()))
|
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer()))
|
||||||
.serializeValuesWith(
|
.serializeValuesWith(
|
||||||
RedisSerializationContext.SerializationPair.fromSerializer(
|
RedisSerializationContext.SerializationPair.fromSerializer(
|
||||||
|
|
|
@ -337,6 +337,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
.fetch()
|
.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Cacheable(
|
||||||
|
value = ["getNewContentUploadCreatorList"],
|
||||||
|
cacheManager = "cacheManager"
|
||||||
|
)
|
||||||
override fun getNewContentUploadCreatorList(
|
override fun getNewContentUploadCreatorList(
|
||||||
cloudfrontHost: String,
|
cloudfrontHost: String,
|
||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
|
@ -372,6 +376,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
.toList()
|
.toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Cacheable(
|
||||||
|
value = ["getAudioContentMainBannerList"],
|
||||||
|
cacheManager = "cacheManager"
|
||||||
|
)
|
||||||
override fun getAudioContentMainBannerList(isAdult: Boolean): List<AudioContentBanner> {
|
override fun getAudioContentMainBannerList(isAdult: Boolean): List<AudioContentBanner> {
|
||||||
var where = audioContentBanner.isActive.isTrue
|
var where = audioContentBanner.isActive.isTrue
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.aws.s3.S3Uploader
|
||||||
import kr.co.vividnext.sodalive.common.SodaException
|
import kr.co.vividnext.sodalive.common.SodaException
|
||||||
import kr.co.vividnext.sodalive.utils.generateFileName
|
import kr.co.vividnext.sodalive.utils.generateFileName
|
||||||
import org.springframework.beans.factory.annotation.Value
|
import org.springframework.beans.factory.annotation.Value
|
||||||
|
import org.springframework.cache.annotation.Cacheable
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
@ -20,6 +21,10 @@ class EventService(
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val cloudFrontHost: String
|
private val cloudFrontHost: String
|
||||||
) {
|
) {
|
||||||
|
@Cacheable(
|
||||||
|
value = ["getEventList"],
|
||||||
|
cacheManager = "cacheManager"
|
||||||
|
)
|
||||||
fun getEventList(): GetEventResponse {
|
fun getEventList(): GetEventResponse {
|
||||||
val eventList = repository.getEventList()
|
val eventList = repository.getEventList()
|
||||||
.asSequence()
|
.asSequence()
|
||||||
|
|
|
@ -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.QMember.member
|
||||||
import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing
|
import kr.co.vividnext.sodalive.member.following.QCreatorFollowing.creatorFollowing
|
||||||
import org.springframework.beans.factory.annotation.Value
|
import org.springframework.beans.factory.annotation.Value
|
||||||
|
import org.springframework.cache.annotation.Cacheable
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
|
||||||
|
@ -19,6 +20,10 @@ class LiveRecommendRepository(
|
||||||
@Value("\${cloud.aws.cloud-front.host}")
|
@Value("\${cloud.aws.cloud-front.host}")
|
||||||
private val cloudFrontHost: String
|
private val cloudFrontHost: String
|
||||||
) {
|
) {
|
||||||
|
@Cacheable(
|
||||||
|
value = ["getRecommendLive"],
|
||||||
|
cacheManager = "cacheManager"
|
||||||
|
)
|
||||||
fun getRecommendLive(
|
fun getRecommendLive(
|
||||||
memberId: Long,
|
memberId: Long,
|
||||||
isBlocked: (Long) -> Boolean,
|
isBlocked: (Long) -> Boolean,
|
||||||
|
|
Loading…
Reference in New Issue