From 5dd9d35aea35039c2074faf2541fcba6054f469d Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:02:07 +0900 Subject: [PATCH 01/22] =?UTF-8?q?:memo:=20EnableCachingConfig=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../andreas311/miso/global/config/EnableCachingConfig.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/global/config/EnableCachingConfig.kt diff --git a/src/main/kotlin/andreas311/miso/global/config/EnableCachingConfig.kt b/src/main/kotlin/andreas311/miso/global/config/EnableCachingConfig.kt new file mode 100644 index 00000000..d085daf3 --- /dev/null +++ b/src/main/kotlin/andreas311/miso/global/config/EnableCachingConfig.kt @@ -0,0 +1,8 @@ +package andreas311.miso.global.config + +import org.springframework.cache.annotation.EnableCaching +import org.springframework.context.annotation.Configuration + +@Configuration +@EnableCaching +class EnableCachingConfig \ No newline at end of file From d2a816856139420a7ec187bfd54035e6ef25c099 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:02:20 +0900 Subject: [PATCH 02/22] =?UTF-8?q?:memo:=20RedisCacheConfig=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/global/redis/RedisCacheConfig.kt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/kotlin/andreas311/miso/global/redis/RedisCacheConfig.kt diff --git a/src/main/kotlin/andreas311/miso/global/redis/RedisCacheConfig.kt b/src/main/kotlin/andreas311/miso/global/redis/RedisCacheConfig.kt new file mode 100644 index 00000000..646a6fac --- /dev/null +++ b/src/main/kotlin/andreas311/miso/global/redis/RedisCacheConfig.kt @@ -0,0 +1,31 @@ +package andreas311.miso.global.redis + +import org.springframework.cache.CacheManager +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.data.redis.cache.RedisCacheConfiguration +import org.springframework.data.redis.cache.RedisCacheManager +import org.springframework.data.redis.connection.RedisConnectionFactory +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer +import org.springframework.data.redis.serializer.RedisSerializationContext +import org.springframework.data.redis.serializer.StringRedisSerializer +import java.time.Duration + +@Configuration +class RedisCacheConfig { + @Bean + fun redisCacheManager(redisConnectionFactory: RedisConnectionFactory): CacheManager { + val redisCacheConfiguration = RedisCacheConfiguration + .defaultCacheConfig() + .disableCachingNullValues() + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(GenericJackson2JsonRedisSerializer())) + .entryTtl(Duration.ofMinutes(30)) + + return RedisCacheManager + .RedisCacheManagerBuilder + .fromConnectionFactory(redisConnectionFactory) + .cacheDefaults(redisCacheConfiguration) + .build() + } +} \ No newline at end of file From effdab696e1112172862b657915597f2794c2b36 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:04:25 +0900 Subject: [PATCH 03/22] =?UTF-8?q?:memo:=20DetailEnvironmentDto=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/port/input/dto/DetailEnvironmentDto.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/environment/application/port/input/dto/DetailEnvironmentDto.kt b/src/main/kotlin/andreas311/miso/domain/environment/application/port/input/dto/DetailEnvironmentDto.kt index 76e2dde1..802431f9 100644 --- a/src/main/kotlin/andreas311/miso/domain/environment/application/port/input/dto/DetailEnvironmentDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/environment/application/port/input/dto/DetailEnvironmentDto.kt @@ -3,9 +3,9 @@ package andreas311.miso.domain.environment.application.port.input.dto import andreas311.miso.domain.environment.domain.TodayEnvironment data class DetailEnvironmentDto( - val title: String, - val content: String, - val imageUrl: String? + val title: String = "", + val content: String = "", + val imageUrl: String? = "" ) { constructor(todayEnvironment: TodayEnvironment): this( title = todayEnvironment.title, From be2d407524968a9950a5113bf822806f7ed158f4 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:29:29 +0900 Subject: [PATCH 04/22] =?UTF-8?q?:memo:=20DetailItemDto=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/application/port/input/dto/DetailItemDto.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/DetailItemDto.kt b/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/DetailItemDto.kt index bc3d5ffc..8be7a0be 100644 --- a/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/DetailItemDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/DetailItemDto.kt @@ -3,12 +3,12 @@ package andreas311.miso.domain.item.application.port.input.dto import andreas311.miso.domain.item.domain.Item data class DetailItemDto( - val id: Long, - val price: Int, - val amount: Int, - val name: String, - val content: String, - val imageUrl: String? + val id: Long = 0L, + val price: Int = 0, + val amount: Int = 0, + val name: String = "", + val content: String = "", + val imageUrl: String? = "" ) { constructor(item: Item) : this( id = item.id, From 29a7852bc89721231e722b73a5ae294f7bf90374 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:29:45 +0900 Subject: [PATCH 05/22] =?UTF-8?q?:memo:=20DetailNotificationDto=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/port/input/dto/DetailNotificationDto.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/andreas311/miso/domain/notification/application/port/input/dto/DetailNotificationDto.kt b/src/main/kotlin/andreas311/miso/domain/notification/application/port/input/dto/DetailNotificationDto.kt index 2205d9a6..e3e7888e 100644 --- a/src/main/kotlin/andreas311/miso/domain/notification/application/port/input/dto/DetailNotificationDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/notification/application/port/input/dto/DetailNotificationDto.kt @@ -3,7 +3,7 @@ package andreas311.miso.domain.notification.application.port.input.dto import andreas311.miso.domain.notification.domain.Notification data class DetailNotificationDto( - val answer: String + val answer: String = "" ) { constructor(notification: Notification) : this( answer = notification.answer From 0d20d9c152afdb1c9069525392da8fd3d40b1a44 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:30:22 +0900 Subject: [PATCH 06/22] =?UTF-8?q?:memo:=20DetailRecyclablesDto=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../port/input/dto/DetailRecyclablesDto.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/recyclables/application/port/input/dto/DetailRecyclablesDto.kt b/src/main/kotlin/andreas311/miso/domain/recyclables/application/port/input/dto/DetailRecyclablesDto.kt index 5055cdd0..0917b078 100644 --- a/src/main/kotlin/andreas311/miso/domain/recyclables/application/port/input/dto/DetailRecyclablesDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/recyclables/application/port/input/dto/DetailRecyclablesDto.kt @@ -4,15 +4,15 @@ import andreas311.miso.domain.recyclables.domain.Recyclables import andreas311.miso.domain.recyclables.domain.RecyclablesType data class DetailRecyclablesDto( - val id: Long, - val title: String, - val subTitle: String, - val recycleMethod: String, - val recycleTip: String, - val recycleCaution: String, - val imageUrl: String?, - val recyclablesType: RecyclablesType, - val recycleMark: String + val id: Long = 0L, + val title: String = "", + val subTitle: String = "", + val recycleMethod: String = "", + val recycleTip: String = "", + val recycleCaution: String = "", + val imageUrl: String? = "", + val recyclablesType: RecyclablesType = RecyclablesType.BAG, + val recycleMark: String = "" ) { constructor(recyclables: Recyclables) : this( id = recyclables.id, From 25df91bc168ae3165acedf7e523bf962425e4108 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:31:34 +0900 Subject: [PATCH 07/22] =?UTF-8?q?:memo:=20ItemDto=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/item/application/port/input/dto/ItemDto.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/ItemDto.kt b/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/ItemDto.kt index fa27a7dd..ce758fb1 100644 --- a/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/ItemDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/item/application/port/input/dto/ItemDto.kt @@ -3,11 +3,11 @@ package andreas311.miso.domain.item.application.port.input.dto import andreas311.miso.domain.item.domain.Item data class ItemDto( - val id: Long, - val price: Int, - val amount: Int, - val name: String, - val imageUrl: String? + val id: Long = 0L, + val price: Int = 0, + val amount: Int = 0, + val name: String = "", + val imageUrl: String? = "" ) { constructor(item: Item) : this( id = item.id, From 8b9024da58d7c48324c7e4c1c81f8108fbdfaedf Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:31:43 +0900 Subject: [PATCH 08/22] =?UTF-8?q?:memo:=20PointDto=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/user/application/port/input/dto/PointDto.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/PointDto.kt b/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/PointDto.kt index e98cdd37..dd21f99f 100644 --- a/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/PointDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/PointDto.kt @@ -3,7 +3,7 @@ package andreas311.miso.domain.user.application.port.input.dto import andreas311.miso.domain.user.domain.User data class PointDto( - val point: Int + val point: Int = 0 ) { constructor(user: User) : this( point = user.point From d7f9e09b9611777c7c7c6ceb291841c79df1caa0 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:31:57 +0900 Subject: [PATCH 09/22] =?UTF-8?q?:memo:=20UserInfoDto=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=20=EC=B4=88=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/user/application/port/input/dto/UserInfoDto.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/UserInfoDto.kt b/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/UserInfoDto.kt index cb0af6f5..20fe5fa3 100644 --- a/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/UserInfoDto.kt +++ b/src/main/kotlin/andreas311/miso/domain/user/application/port/input/dto/UserInfoDto.kt @@ -5,9 +5,9 @@ import andreas311.miso.domain.user.domain.User import java.util.* data class UserInfoDto( - val id: UUID, - val email: String, - val role: Role + val id: UUID = UUID.randomUUID(), + val email: String = "", + val role: Role = Role.ROLE_USER ) { constructor(user: User) : this( id = user.id, From 004bc39b2da796de34cf297cc7962d3418c55ff1 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:34:03 +0900 Subject: [PATCH 10/22] =?UTF-8?q?:memo:=20RedisConfig=20=EC=97=90=EC=84=9C?= =?UTF-8?q?=20redisTemplate=20=ED=95=A8=EC=88=98=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=EC=9D=84=20redisTemplateManager=20=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/andreas311/miso/global/redis/RedisConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/andreas311/miso/global/redis/RedisConfig.kt b/src/main/kotlin/andreas311/miso/global/redis/RedisConfig.kt index 388ddf10..8f8ad6d5 100644 --- a/src/main/kotlin/andreas311/miso/global/redis/RedisConfig.kt +++ b/src/main/kotlin/andreas311/miso/global/redis/RedisConfig.kt @@ -19,7 +19,7 @@ class RedisConfig( LettuceConnectionFactory(redisProperties.host, redisProperties.port) @Bean - fun redisTemplate(): RedisTemplate { + fun redisTemplateManager(): RedisTemplate { val redisTemplate = RedisTemplate() redisTemplate.keySerializer = StringRedisSerializer() redisTemplate.valueSerializer = StringRedisSerializer() From cce528543dd34bfa7db5385dc3c447ea6e613610 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:35:57 +0900 Subject: [PATCH 11/22] =?UTF-8?q?:memo:=20DetailEnvironmentService=20?= =?UTF-8?q?=EC=97=90=20look=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9E=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../environment/application/service/DetailEnvironmentService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/environment/application/service/DetailEnvironmentService.kt b/src/main/kotlin/andreas311/miso/domain/environment/application/service/DetailEnvironmentService.kt index f8c3e83c..094286a1 100644 --- a/src/main/kotlin/andreas311/miso/domain/environment/application/service/DetailEnvironmentService.kt +++ b/src/main/kotlin/andreas311/miso/domain/environment/application/service/DetailEnvironmentService.kt @@ -4,11 +4,13 @@ import andreas311.miso.common.annotation.ReadOnlyRollbackService import andreas311.miso.domain.environment.application.port.input.DetailEnvironmentUseCase import andreas311.miso.domain.environment.application.port.input.dto.DetailEnvironmentDto import andreas311.miso.domain.environment.application.port.output.QueryTodayEnvironmentPort +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class DetailEnvironmentService( private val queryTodayEnvironmentPort: QueryTodayEnvironmentPort ) : DetailEnvironmentUseCase { + @Cacheable(cacheNames = ["environment"], key = "'todayEnvironment'", cacheManager = "redisCacheManager") override fun execute(): DetailEnvironmentDto { val environment = queryTodayEnvironmentPort.findOne() From 950557681e4b49bba4c590110882d6267a0614b7 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:36:11 +0900 Subject: [PATCH 12/22] =?UTF-8?q?:memo:=20DetailItemService=20=EC=97=90=20?= =?UTF-8?q?look=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/item/application/service/DetailItemService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/item/application/service/DetailItemService.kt b/src/main/kotlin/andreas311/miso/domain/item/application/service/DetailItemService.kt index e9eb288d..37ea2dd2 100644 --- a/src/main/kotlin/andreas311/miso/domain/item/application/service/DetailItemService.kt +++ b/src/main/kotlin/andreas311/miso/domain/item/application/service/DetailItemService.kt @@ -5,11 +5,13 @@ import andreas311.miso.domain.item.application.exception.ItemNotFoundException import andreas311.miso.domain.item.application.port.input.DetailItemUseCase import andreas311.miso.domain.item.application.port.input.dto.DetailItemDto import andreas311.miso.domain.item.application.port.output.QueryItemPort +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class DetailItemService( private val queryItemPort: QueryItemPort ) : DetailItemUseCase { + @Cacheable(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager") override fun execute(id: Long): DetailItemDto { val item = queryItemPort.findByIdOrNull(id) ?: throw ItemNotFoundException() From 8f5897ed15442de236ef5e428fe76d56e6bbc6f9 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:36:24 +0900 Subject: [PATCH 13/22] =?UTF-8?q?:memo:=20DetailNotificationService=20?= =?UTF-8?q?=EC=97=90=20look=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9E=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/DetailNotificationService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/notification/application/service/DetailNotificationService.kt b/src/main/kotlin/andreas311/miso/domain/notification/application/service/DetailNotificationService.kt index 0843cc40..1865a835 100644 --- a/src/main/kotlin/andreas311/miso/domain/notification/application/service/DetailNotificationService.kt +++ b/src/main/kotlin/andreas311/miso/domain/notification/application/service/DetailNotificationService.kt @@ -5,11 +5,13 @@ import andreas311.miso.domain.notification.application.exception.NotificationNot import andreas311.miso.domain.notification.application.port.input.DetailNotificationUseCase import andreas311.miso.domain.notification.application.port.input.dto.DetailNotificationDto import andreas311.miso.domain.notification.application.port.output.QueryNotificationPort +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class DetailNotificationService( private val queryNotificationPort: QueryNotificationPort ) : DetailNotificationUseCase { + @Cacheable(cacheNames = ["inquiryRespond"], key = "#id", cacheManager = "redisCacheManager") override fun execute(id: Long): DetailNotificationDto { val notification = queryNotificationPort.findByInquiryIdOrNull(id) ?: throw NotificationNotFoundException() From 872d843eb3a5069560c2f7ea9bee9b836b5eb90a Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:36:38 +0900 Subject: [PATCH 14/22] =?UTF-8?q?:memo:=20DetailRecyclablesService=20?= =?UTF-8?q?=EC=97=90=20look=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9E=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recyclables/application/service/DetailRecyclablesService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DetailRecyclablesService.kt b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DetailRecyclablesService.kt index 4650fb7d..c0c619d7 100644 --- a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DetailRecyclablesService.kt +++ b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DetailRecyclablesService.kt @@ -6,11 +6,13 @@ import andreas311.miso.domain.recyclables.application.port.input.DetailRecyclabl import andreas311.miso.domain.recyclables.application.port.input.dto.DetailRecyclablesDto import andreas311.miso.domain.recyclables.application.port.output.QueryRecyclablesPort import andreas311.miso.domain.recyclables.domain.RecyclablesType +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class DetailRecyclablesService( private val queryRecyclablesPort: QueryRecyclablesPort ) : DetailRecyclablesUseCase { + @Cacheable(cacheNames = ["recyclables"], key = "#recyclablesType", cacheManager = "redisCacheManager") override fun execute(recyclablesType: RecyclablesType): DetailRecyclablesDto { val recyclables = queryRecyclablesPort.findByRecyclablesTypeOrNull(recyclablesType) ?: throw RecyclablesNotFoundException() From 233fdedbc1424f37a0367f2e9f65ae108c641e9d Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:36:49 +0900 Subject: [PATCH 15/22] =?UTF-8?q?:memo:=20GetPointService=20=EC=97=90=20lo?= =?UTF-8?q?ok=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/user/application/service/GetPointService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/user/application/service/GetPointService.kt b/src/main/kotlin/andreas311/miso/domain/user/application/service/GetPointService.kt index 72e8fdf3..13fbaf44 100644 --- a/src/main/kotlin/andreas311/miso/domain/user/application/service/GetPointService.kt +++ b/src/main/kotlin/andreas311/miso/domain/user/application/service/GetPointService.kt @@ -4,11 +4,13 @@ import andreas311.miso.common.annotation.ReadOnlyRollbackService import andreas311.miso.domain.auth.application.port.output.UserSecurityPort import andreas311.miso.domain.user.application.port.input.GetPointUseCase import andreas311.miso.domain.user.application.port.input.dto.PointDto +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class GetPointService( private val userSecurityPort: UserSecurityPort ) : GetPointUseCase { + @Cacheable(cacheNames = ["userPoint"], key = "'userPoint'", cacheManager = "redisCacheManager") override fun execute(): PointDto { val user = userSecurityPort.currentUser() From 2bdf7bab633173ed1fe57d1f0ef764b83e50737d Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:37:03 +0900 Subject: [PATCH 16/22] =?UTF-8?q?:memo:=20UserInfoService=20=EC=97=90=20lo?= =?UTF-8?q?ok=20aside=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/user/application/service/UserInfoService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/user/application/service/UserInfoService.kt b/src/main/kotlin/andreas311/miso/domain/user/application/service/UserInfoService.kt index e1fa8df5..b42613f6 100644 --- a/src/main/kotlin/andreas311/miso/domain/user/application/service/UserInfoService.kt +++ b/src/main/kotlin/andreas311/miso/domain/user/application/service/UserInfoService.kt @@ -4,11 +4,13 @@ import andreas311.miso.common.annotation.ReadOnlyRollbackService import andreas311.miso.domain.auth.application.port.output.UserSecurityPort import andreas311.miso.domain.user.application.port.input.UserInfoUseCase import andreas311.miso.domain.user.application.port.input.dto.UserInfoDto +import org.springframework.cache.annotation.Cacheable @ReadOnlyRollbackService class UserInfoService( private val userSecurityPort: UserSecurityPort ) : UserInfoUseCase { + @Cacheable(cacheNames = ["user"], key = "'userInfo'", cacheManager = "redisCacheManager") override fun execute(): UserInfoDto { val user = userSecurityPort.currentUser() From ea5c32f9c9234fe8675084e71cd4e06cdb8d8410 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:37:26 +0900 Subject: [PATCH 17/22] =?UTF-8?q?:memo:=20DeleteItemService=20=EC=97=90=20?= =?UTF-8?q?write=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/item/application/service/DeleteItemService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/item/application/service/DeleteItemService.kt b/src/main/kotlin/andreas311/miso/domain/item/application/service/DeleteItemService.kt index dfb10559..9a2d5b9f 100644 --- a/src/main/kotlin/andreas311/miso/domain/item/application/service/DeleteItemService.kt +++ b/src/main/kotlin/andreas311/miso/domain/item/application/service/DeleteItemService.kt @@ -5,12 +5,14 @@ import andreas311.miso.domain.item.application.exception.ItemNotFoundException import andreas311.miso.domain.item.application.port.input.DeleteItemUseCase import andreas311.miso.domain.item.application.port.output.CommandItemPort import andreas311.miso.domain.item.application.port.output.QueryItemPort +import org.springframework.cache.annotation.CacheEvict @RollbackService class DeleteItemService( private val queryItemPort: QueryItemPort, private val commandItemPort: CommandItemPort ) : DeleteItemUseCase { + @CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager") override fun execute(id: Long) { val itemEntity = queryItemPort.findByIdOrNull(id) ?: throw ItemNotFoundException() From d8dde745001b9e269d437e14755c46b41df81aee Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:37:33 +0900 Subject: [PATCH 18/22] =?UTF-8?q?:memo:=20DeleteRecyclablesService=20?= =?UTF-8?q?=EC=97=90=20write=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9E=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recyclables/application/service/DeleteRecyclablesService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DeleteRecyclablesService.kt b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DeleteRecyclablesService.kt index 6bf76bdc..de8b397c 100644 --- a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DeleteRecyclablesService.kt +++ b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/DeleteRecyclablesService.kt @@ -5,12 +5,14 @@ import andreas311.miso.domain.recyclables.application.exception.RecyclablesNotFo import andreas311.miso.domain.recyclables.application.port.input.DeleteRecyclablesUseCase import andreas311.miso.domain.recyclables.application.port.output.CommandRecyclablesPort import andreas311.miso.domain.recyclables.application.port.output.QueryRecyclablesPort +import org.springframework.cache.annotation.CacheEvict @RollbackService class DeleteRecyclablesService( private val queryRecyclablesPort: QueryRecyclablesPort, private val commandRecyclablesPort: CommandRecyclablesPort ) : DeleteRecyclablesUseCase { + @CacheEvict(cacheNames = ["recyclables"], key = "#id", cacheManager = "redisCacheManager") override fun execute(id: Long) { val recyclablesEntity = queryRecyclablesPort.findByIdOrNull(id) ?: throw RecyclablesNotFoundException() From 52ccd0b6bdbe6196e949decec5032f7bc64bbb02 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:37:43 +0900 Subject: [PATCH 19/22] =?UTF-8?q?:memo:=20EditItemService=20=EC=97=90=20wr?= =?UTF-8?q?ite=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/item/application/service/EditItemService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/item/application/service/EditItemService.kt b/src/main/kotlin/andreas311/miso/domain/item/application/service/EditItemService.kt index d32609a5..bfe1f044 100644 --- a/src/main/kotlin/andreas311/miso/domain/item/application/service/EditItemService.kt +++ b/src/main/kotlin/andreas311/miso/domain/item/application/service/EditItemService.kt @@ -7,6 +7,7 @@ import andreas311.miso.domain.item.application.port.output.CommandItemPort import andreas311.miso.domain.item.application.port.output.QueryItemPort import andreas311.miso.domain.item.domain.Item import andreas311.miso.thirdparty.aws.s3.util.S3Util +import org.springframework.cache.annotation.CacheEvict import org.springframework.stereotype.Component import org.springframework.web.multipart.MultipartFile @@ -16,6 +17,7 @@ class EditItemService( private val queryItemPort: QueryItemPort, private val commandItemPort: CommandItemPort ) : EditItemUseCase { + @CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager") override fun execute(id: Long, editItemDto: EditItemDto, multipartFile: MultipartFile?) { val item = queryItemPort.findByIdOrNull(id) ?: throw ItemNotFoundException() From 386a4aee07aaccf26d450d5d73a729e1ae33fba1 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:38:00 +0900 Subject: [PATCH 20/22] =?UTF-8?q?:memo:=20EditRecyclablesService=20?= =?UTF-8?q?=EC=97=90=20write=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84?= =?UTF-8?q?=EB=9E=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recyclables/application/service/EditRecyclablesService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/EditRecyclablesService.kt b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/EditRecyclablesService.kt index 07e8ef12..b6c0f126 100644 --- a/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/EditRecyclablesService.kt +++ b/src/main/kotlin/andreas311/miso/domain/recyclables/application/service/EditRecyclablesService.kt @@ -8,6 +8,7 @@ import andreas311.miso.domain.recyclables.application.port.output.CommandRecycla import andreas311.miso.domain.recyclables.application.port.output.QueryRecyclablesPort import andreas311.miso.domain.recyclables.domain.Recyclables import andreas311.miso.thirdparty.aws.s3.util.S3Util +import org.springframework.cache.annotation.CacheEvict import org.springframework.web.multipart.MultipartFile @RollbackService @@ -16,6 +17,7 @@ class EditRecyclablesService( private val queryRecyclablesPort: QueryRecyclablesPort, private val commandRecyclablesPort: CommandRecyclablesPort ) : EditRecyclablesUseCase { + @CacheEvict(cacheNames = ["recyclables"], key = "#editRecyclablesDto.recyclablesType", cacheManager = "redisCacheManager") override fun execute(id: Long, editRecyclablesDto: EditRecyclablesDto, multipartFile: MultipartFile?) { val recyclables = queryRecyclablesPort.findByIdOrNull(id) ?: throw RecyclablesNotFoundException() From 509f7e6f834c4699a8a335d54fbe98f8215a55ce Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:38:09 +0900 Subject: [PATCH 21/22] =?UTF-8?q?:memo:=20GivePointService=20=EC=97=90=20w?= =?UTF-8?q?rite=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../miso/domain/user/application/service/GivePointService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/user/application/service/GivePointService.kt b/src/main/kotlin/andreas311/miso/domain/user/application/service/GivePointService.kt index 6d5ed38e..f8616600 100644 --- a/src/main/kotlin/andreas311/miso/domain/user/application/service/GivePointService.kt +++ b/src/main/kotlin/andreas311/miso/domain/user/application/service/GivePointService.kt @@ -4,12 +4,14 @@ import andreas311.miso.common.annotation.RollbackService import andreas311.miso.domain.auth.application.port.output.UserSecurityPort import andreas311.miso.domain.user.application.port.input.GivePointUseCase import andreas311.miso.domain.user.application.port.output.CommandUserPort +import org.springframework.cache.annotation.CacheEvict @RollbackService class GivePointService( private val commandUserPort: CommandUserPort, private val userSecurityPort: UserSecurityPort ) : GivePointUseCase { + @CacheEvict(cacheNames = ["userPoint"], key = "'userPoint'", cacheManager = "redisCacheManager") override fun execute() { val user = userSecurityPort.currentUser() From 25999d6378e16ba21118088b4cda58edd182a767 Mon Sep 17 00:00:00 2001 From: uuuuuuuk Date: Mon, 22 Apr 2024 22:38:16 +0900 Subject: [PATCH 22/22] =?UTF-8?q?:memo:=20PurchaseItemService=20=EC=97=90?= =?UTF-8?q?=20write=20around=20=EC=BA=90=EC=8B=9C=20=EC=A0=84=EB=9E=B5=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/purchase/application/service/PurchaseItemService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/andreas311/miso/domain/purchase/application/service/PurchaseItemService.kt b/src/main/kotlin/andreas311/miso/domain/purchase/application/service/PurchaseItemService.kt index 4196d647..f1473efc 100644 --- a/src/main/kotlin/andreas311/miso/domain/purchase/application/service/PurchaseItemService.kt +++ b/src/main/kotlin/andreas311/miso/domain/purchase/application/service/PurchaseItemService.kt @@ -11,6 +11,7 @@ import andreas311.miso.domain.purchase.application.port.input.PurchaseItemUseCas import andreas311.miso.domain.purchase.application.port.output.CommandPurchasePort import andreas311.miso.domain.purchase.domain.Purchase import andreas311.miso.domain.user.application.port.output.CommandUserPort +import org.springframework.cache.annotation.CacheEvict import java.time.LocalDateTime @RollbackService @@ -21,6 +22,7 @@ class PurchaseItemService( private val userSecurityPort: UserSecurityPort, private val commandPurchasePort: CommandPurchasePort ) : PurchaseItemUseCase { + @CacheEvict(cacheNames = ["userPoint"], key = "'userPoint'", cacheManager = "redisCacheManager") override fun execute(id: Long) { val user = userSecurityPort.currentUser()