From bd4efc8f320a4b42066a82153c759478314fe872 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:26:25 +0900 Subject: [PATCH 01/27] =?UTF-8?q?add=20::=20RedisCacheConfig=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gauth/global/redis/RedisCacheConfig.kt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt new file mode 100644 index 00000000..892460fb --- /dev/null +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -0,0 +1,37 @@ +package com.msg.gauth.global.redis + +import org.springframework.cache.CacheManager +import org.springframework.cache.annotation.EnableCaching +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 +@EnableCaching +class RedisCacheConfig { + + @Bean + fun clientCacheManager(factory: RedisConnectionFactory?): CacheManager { + val cacheConfig = RedisCacheConfiguration.defaultCacheConfig() + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) + .serializeValuesWith( + RedisSerializationContext.SerializationPair.fromSerializer( + GenericJackson2JsonRedisSerializer() + ) + ) + .entryTtl(Duration.ofMinutes(1L)) + + return RedisCacheManager + .RedisCacheManagerBuilder + .fromConnectionFactory(factory!!) + .cacheDefaults(cacheConfig) + .build() + } + +} \ No newline at end of file From 10d3c08ad86a1b4063c67da3b1b3f05d7dfd1222 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:26:41 +0900 Subject: [PATCH 02/27] =?UTF-8?q?add=20::=20Spring=20Cache=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 ++ buildSrc/src/main/kotlin/Dependencies.kt | 1 + 2 files changed, 3 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 72a102a6..1a5a7636 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -43,6 +43,8 @@ dependencies { testImplementation(Dependencies.SPRING_SECURITY_TEST) implementation(Dependencies.SPRING_AOP) implementation(Dependencies.SPRING_ACTUATOR) + implementation(Dependencies.SPRING_CACHE) + // kotlin implementation(Dependencies.JACKSON_MODULE_KOTLIN) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 59f30b0e..ea5c2bb1 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -17,6 +17,7 @@ object Dependencies { const val SPRING_SECURITY_TEST = "org.springframework.security:spring-security-test" const val SPRING_AOP = "org.springframework.boot:spring-boot-starter-aop" const val SPRING_ACTUATOR = "org.springframework.boot:spring-boot-starter-actuator" + const val SPRING_CACHE = "org.springframework.boot:spring-boot-starter-cache" // jackson const val JACKSON_MODULE_KOTLIN = "com.fasterxml.jackson.module:jackson-module-kotlin" From ba8f29f59e0526e1507ac13fc396a4b5bbcd6248 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:27:18 +0900 Subject: [PATCH 03/27] =?UTF-8?q?add=20::=20CacheEvict=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msg/gauth/domain/client/service/DeleteClientService.kt | 2 ++ .../com/msg/gauth/domain/client/service/DeleteClientsService.kt | 2 ++ .../msg/gauth/domain/client/service/RegisterClientService.kt | 2 ++ .../msg/gauth/domain/client/service/UpdateAnyClientService.kt | 2 ++ .../com/msg/gauth/domain/client/service/UpdateClientService.kt | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt index d3f402f1..56984311 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt @@ -5,6 +5,7 @@ import com.msg.gauth.domain.client.exception.UserNotMatchException import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.domain.user.util.UserUtil import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict import org.springframework.data.repository.findByIdOrNull @TransactionalService @@ -13,6 +14,7 @@ class DeleteClientService( private val userUtil: UserUtil, ) { + @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(id: Long) { val client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt index e1a9f786..8cbf7581 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt @@ -3,6 +3,7 @@ package com.msg.gauth.domain.client.service import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.domain.user.util.UserUtil import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict @TransactionalService class DeleteClientsService( @@ -10,6 +11,7 @@ class DeleteClientsService( private val userUtil: UserUtil ) { + @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(ids: List) { val user = userUtil.fetchCurrentUser() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt index 271c3332..eac23eea 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt @@ -5,6 +5,7 @@ import com.msg.gauth.domain.client.presentation.dto.response.ClientRegisterResDt import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.domain.user.util.UserUtil import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict import java.util.UUID @TransactionalService @@ -13,6 +14,7 @@ class RegisterClientService( private val userUtil: UserUtil, ) { + @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(clientRegisterDto: ClientRegisterReqDto): ClientRegisterResDto { val (clientSecret, clientId) = createUUID() to createUUID() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt index 8c147e79..bd10c935 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt @@ -5,6 +5,7 @@ import com.msg.gauth.domain.client.exception.ClientNotFindException import com.msg.gauth.domain.client.presentation.dto.request.ClientUpdateReqDto import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict import org.springframework.data.repository.findByIdOrNull @TransactionalService @@ -12,6 +13,7 @@ class UpdateAnyClientService( private val clientRepository: ClientRepository ) { + @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client: Client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt index 4046eac1..87d46f56 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt @@ -5,6 +5,7 @@ import com.msg.gauth.domain.client.presentation.dto.request.ClientUpdateReqDto import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.domain.user.util.UserUtil import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict @TransactionalService class UpdateClientService( @@ -12,6 +13,7 @@ class UpdateClientService( private val userUtil: UserUtil ) { + @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun updateClient(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client = clientRepository.findByIdAndCreatedBy(id, userUtil.fetchCurrentUser()) ?: throw ClientNotFindException() From 10285707fec1e5b60d6d898612a344e4f0ff6174 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:27:30 +0900 Subject: [PATCH 04/27] =?UTF-8?q?add=20::=20JsonProperty=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SingleClientResDto.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/SingleClientResDto.kt b/src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/SingleClientResDto.kt index ec999642..2b2011fb 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/SingleClientResDto.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/SingleClientResDto.kt @@ -1,17 +1,18 @@ package com.msg.gauth.domain.client.presentation.dto.response +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty import com.msg.gauth.domain.client.Client import com.msg.gauth.domain.client.enums.ServiceScope -data class SingleClientResDto( - val id: Long, - val clientId: String, - val serviceName: String, - val serviceUri: String, - val serviceScope: ServiceScope, - val serviceImgUrl: String +data class SingleClientResDto @JsonCreator constructor( + @JsonProperty("id") val id: Long, + @JsonProperty("clientId") val clientId: String, + @JsonProperty("serviceName") val serviceName: String, + @JsonProperty("serviceUri") val serviceUri: String, + @JsonProperty("serviceScope") val serviceScope: ServiceScope, + @JsonProperty("serviceImgUrl") val serviceImgUrl: String ) { - constructor(client: Client) : this( id = client.id, clientId = client.clientId, From 9b3c22de0398dfbedeaaaad192368dd82f1c62b9 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:27:42 +0900 Subject: [PATCH 05/27] =?UTF-8?q?add=20::=20Cacheable=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msg/gauth/domain/client/service/GetAllClientsService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt index 2d1b8014..3c659a5a 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt @@ -4,12 +4,14 @@ import com.msg.gauth.domain.client.enums.ServiceScope import com.msg.gauth.domain.client.presentation.dto.response.SingleClientResDto import com.msg.gauth.domain.client.repository.ClientRepository import com.msg.gauth.global.annotation.service.ReadOnlyService +import org.springframework.cache.annotation.Cacheable @ReadOnlyService class GetAllClientsService( private val clientRepository: ClientRepository ) { + @Cacheable(value = ["Clients"], cacheManager = "clientCacheManager") fun execute(): List = clientRepository.findByServiceScope(ServiceScope.PUBLIC) .map { SingleClientResDto(it) } From 447b116a527d33d770ef1b7bc1789754a5af4f71 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:28:01 +0900 Subject: [PATCH 06/27] =?UTF-8?q?add=20::=20EnableCaching=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt b/src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt index d41a7aa1..c52e2e4b 100644 --- a/src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt +++ b/src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt @@ -3,10 +3,12 @@ package com.msg.gauth import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.context.properties.ConfigurationPropertiesScan import org.springframework.boot.runApplication +import org.springframework.cache.annotation.EnableCaching import java.util.* @SpringBootApplication @ConfigurationPropertiesScan +@EnableCaching class GauthBackendApplication fun main(args: Array) { From e3fb0338afdc9865412bba140cd342b8d5af7134 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:52:29 +0900 Subject: [PATCH 07/27] =?UTF-8?q?add=20::=20userCacheManager=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/gauth/global/redis/RedisCacheConfig.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index 892460fb..2ff729b9 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -34,4 +34,22 @@ class RedisCacheConfig { .build() } + @Bean + fun userCacheManager(factory: RedisConnectionFactory?): CacheManager { + val cacheConfig = RedisCacheConfiguration.defaultCacheConfig() + .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) + .serializeValuesWith( + RedisSerializationContext.SerializationPair.fromSerializer( + GenericJackson2JsonRedisSerializer() + ) + ) + .entryTtl(Duration.ofMinutes(1L)) + + return RedisCacheManager + .RedisCacheManagerBuilder + .fromConnectionFactory(factory!!) + .cacheDefaults(cacheConfig) + .build() + } + } \ No newline at end of file From a259f59e8f48aeddde70805416d1c6ef97c572db Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:53:15 +0900 Subject: [PATCH 08/27] =?UTF-8?q?add=20::=20Cacheable=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index 8e5aaa69..2c234319 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -5,11 +5,14 @@ import com.msg.gauth.domain.user.presentation.dto.request.AcceptedUserRequest import com.msg.gauth.domain.user.presentation.dto.response.SingleAcceptedUserResDto import com.msg.gauth.domain.user.repository.UserRepository import com.msg.gauth.global.annotation.service.ReadOnlyService +import org.springframework.cache.annotation.Cacheable @ReadOnlyService class GetAcceptedUsersService( private val userRepository: UserRepository, ) { + + @Cacheable(value = ["AcceptedUser"], cacheManager = "userCacheManager") fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From 0f29e9af5638cd98da36c7a93b98bcb0f99a6088 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:53:31 +0900 Subject: [PATCH 09/27] =?UTF-8?q?add=20::=20CacheEvict=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msg/gauth/domain/admin/service/ExcelParsingService.kt | 3 ++- .../msg/gauth/domain/user/service/AcceptUserSignUpService.kt | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt index f680c033..de9bcd16 100644 --- a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt @@ -13,13 +13,14 @@ import org.apache.poi.ss.usermodel.Sheet import org.apache.poi.ss.usermodel.Workbook import org.apache.poi.xssf.usermodel.XSSFWorkbook import org.apache.tika.Tika +import org.springframework.cache.annotation.CacheEvict import org.springframework.web.multipart.MultipartFile @TransactionalService class ExcelParsingService( private val userRepository: UserRepository, ) { - + @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "userCacheManager") fun execute(file: MultipartFile) { val tika = Tika() val detect = tika.detect(file.bytes) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt index 70396255..da2b5028 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt @@ -7,6 +7,7 @@ import com.msg.gauth.domain.user.presentation.dto.request.AcceptUserReqDto import com.msg.gauth.domain.user.repository.UserRepository import com.msg.gauth.domain.user.repository.UserRoleRepository import com.msg.gauth.global.annotation.service.TransactionalService +import org.springframework.cache.annotation.CacheEvict @TransactionalService class AcceptUserSignUpService( @@ -14,6 +15,7 @@ class AcceptUserSignUpService( private val userRoleRepository: UserRoleRepository ) { + @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "userCacheManager") fun execute(id: Long, acceptUserReqDto: AcceptUserReqDto) { val user = userRepository.findByIdAndState(id, UserState.PENDING) ?: throw UserNotFoundException() From 69b46a8c34b1a942f8bf602a18317858cb9cfbd2 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 2 Sep 2024 00:14:47 +0900 Subject: [PATCH 10/27] =?UTF-8?q?add=20::=20Primary=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index 2ff729b9..e625b168 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -4,6 +4,7 @@ import org.springframework.cache.CacheManager import org.springframework.cache.annotation.EnableCaching import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Primary import org.springframework.data.redis.cache.RedisCacheConfiguration import org.springframework.data.redis.cache.RedisCacheManager import org.springframework.data.redis.connection.RedisConnectionFactory @@ -17,6 +18,7 @@ import java.time.Duration class RedisCacheConfig { @Bean + @Primary fun clientCacheManager(factory: RedisConnectionFactory?): CacheManager { val cacheConfig = RedisCacheConfiguration.defaultCacheConfig() .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) From 70d11c64262113e410d9e6bb1c93acb322eca2b8 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 2 Sep 2024 00:55:01 +0900 Subject: [PATCH 11/27] =?UTF-8?q?delete=20::=20=EB=B9=88=EC=A4=84=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1a5a7636..5b419a16 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,7 +45,6 @@ dependencies { implementation(Dependencies.SPRING_ACTUATOR) implementation(Dependencies.SPRING_CACHE) - // kotlin implementation(Dependencies.JACKSON_MODULE_KOTLIN) implementation(Dependencies.KOTLIN_REFLET) From 3183a003cdadde74cec876f28d4b8e965d66c308 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 2 Sep 2024 00:59:48 +0900 Subject: [PATCH 12/27] =?UTF-8?q?update=20::=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=EC=97=90=20=EB=A7=9E=EA=B2=8C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msg/gauth/domain/client/service/DeleteClientService.kt | 2 +- .../com/msg/gauth/domain/client/service/DeleteClientsService.kt | 2 +- .../msg/gauth/domain/client/service/RegisterClientService.kt | 2 +- .../msg/gauth/domain/client/service/UpdateAnyClientService.kt | 2 +- .../com/msg/gauth/domain/client/service/UpdateClientService.kt | 2 +- src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt | 1 - 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt index 56984311..fe1db664 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt @@ -14,7 +14,7 @@ class DeleteClientService( private val userUtil: UserUtil, ) { - @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(id: Long) { val client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt index 8cbf7581..27f8980f 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt @@ -11,7 +11,7 @@ class DeleteClientsService( private val userUtil: UserUtil ) { - @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(ids: List) { val user = userUtil.fetchCurrentUser() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt index eac23eea..35f057d5 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt @@ -14,7 +14,7 @@ class RegisterClientService( private val userUtil: UserUtil, ) { - @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(clientRegisterDto: ClientRegisterReqDto): ClientRegisterResDto { val (clientSecret, clientId) = createUUID() to createUUID() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt index bd10c935..340692d3 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt @@ -13,7 +13,7 @@ class UpdateAnyClientService( private val clientRepository: ClientRepository ) { - @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun execute(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client: Client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt index 87d46f56..fef73057 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt @@ -13,7 +13,7 @@ class UpdateClientService( private val userUtil: UserUtil ) { - @CacheEvict(value= ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") fun updateClient(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client = clientRepository.findByIdAndCreatedBy(id, userUtil.fetchCurrentUser()) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index e625b168..11bf2c8b 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -53,5 +53,4 @@ class RedisCacheConfig { .cacheDefaults(cacheConfig) .build() } - } \ No newline at end of file From 091b55676a82bdfff2c70ed1b0f751f9c016d3b6 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:39:13 +0900 Subject: [PATCH 13/27] =?UTF-8?q?update=20::=201=EB=B6=84=20->=2010?= =?UTF-8?q?=EB=B6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index 11bf2c8b..dad7c5df 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -45,7 +45,7 @@ class RedisCacheConfig { GenericJackson2JsonRedisSerializer() ) ) - .entryTtl(Duration.ofMinutes(1L)) + .entryTtl(Duration.ofMinutes(10L)) return RedisCacheManager .RedisCacheManagerBuilder From 6cf0b02a91c100f4dbe83d63640d18fe79e66228 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:45:08 +0900 Subject: [PATCH 14/27] =?UTF-8?q?update=20::=20clientCacheManager=201?= =?UTF-8?q?=EB=B6=84=20->=2010=EB=B6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index dad7c5df..0cdae175 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -27,7 +27,7 @@ class RedisCacheConfig { GenericJackson2JsonRedisSerializer() ) ) - .entryTtl(Duration.ofMinutes(1L)) + .entryTtl(Duration.ofMinutes(10)) return RedisCacheManager .RedisCacheManagerBuilder @@ -45,7 +45,7 @@ class RedisCacheConfig { GenericJackson2JsonRedisSerializer() ) ) - .entryTtl(Duration.ofMinutes(10L)) + .entryTtl(Duration.ofMinutes(10)) return RedisCacheManager .RedisCacheManagerBuilder From ded532f9c6f192ea900176e153cffecc4c65dfcc Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Tue, 3 Sep 2024 16:45:49 +0900 Subject: [PATCH 15/27] =?UTF-8?q?add=20::=20JsonProperty=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SingleAcceptedUserResDto.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/presentation/dto/response/SingleAcceptedUserResDto.kt b/src/main/kotlin/com/msg/gauth/domain/user/presentation/dto/response/SingleAcceptedUserResDto.kt index 9e15fac3..eddfb4ff 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/presentation/dto/response/SingleAcceptedUserResDto.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/presentation/dto/response/SingleAcceptedUserResDto.kt @@ -1,15 +1,17 @@ package com.msg.gauth.domain.user.presentation.dto.response +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty import com.msg.gauth.domain.user.User -data class SingleAcceptedUserResDto( - val id: Long, - val name: String, - val email: String, - val grade: Int?, - val classNum: Int?, - val num: Int?, - val profileUrl: String? +data class SingleAcceptedUserResDto @JsonCreator constructor( + @JsonProperty("id") val id: Long, + @JsonProperty("name") val name: String, + @JsonProperty("email") val email: String, + @JsonProperty("grade") val grade: Int?, + @JsonProperty("classNum") val classNum: Int?, + @JsonProperty("num") val num: Int?, + @JsonProperty("profileUrl") val profileUrl: String? ) { constructor(user: User) : this( From 4597c4b54d05537c22a0e5c5b6db0f07901f8dfb Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:43:26 +0900 Subject: [PATCH 16/27] =?UTF-8?q?update=20::=20redisCacheManager=EB=A1=9C?= =?UTF-8?q?=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gauth/global/redis/RedisCacheConfig.kt | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index 0cdae175..07db4000 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -18,26 +18,7 @@ import java.time.Duration class RedisCacheConfig { @Bean - @Primary - fun clientCacheManager(factory: RedisConnectionFactory?): CacheManager { - val cacheConfig = RedisCacheConfiguration.defaultCacheConfig() - .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) - .serializeValuesWith( - RedisSerializationContext.SerializationPair.fromSerializer( - GenericJackson2JsonRedisSerializer() - ) - ) - .entryTtl(Duration.ofMinutes(10)) - - return RedisCacheManager - .RedisCacheManagerBuilder - .fromConnectionFactory(factory!!) - .cacheDefaults(cacheConfig) - .build() - } - - @Bean - fun userCacheManager(factory: RedisConnectionFactory?): CacheManager { + fun redisCacheManager(factory: RedisConnectionFactory?): CacheManager { val cacheConfig = RedisCacheConfiguration.defaultCacheConfig() .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer())) .serializeValuesWith( From 1e03118c496b650c100af338555e30ebb5e128d2 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:44:01 +0900 Subject: [PATCH 17/27] =?UTF-8?q?update=20::=20cacheManager=EB=A5=BC=20red?= =?UTF-8?q?isCacheManager=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msg/gauth/domain/client/service/DeleteClientService.kt | 2 +- .../com/msg/gauth/domain/client/service/DeleteClientsService.kt | 2 +- .../com/msg/gauth/domain/client/service/GetAllClientsService.kt | 2 +- .../msg/gauth/domain/client/service/RegisterClientService.kt | 2 +- .../msg/gauth/domain/client/service/UpdateAnyClientService.kt | 2 +- .../com/msg/gauth/domain/client/service/UpdateClientService.kt | 2 +- .../msg/gauth/domain/user/service/AcceptUserSignUpService.kt | 2 +- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt index fe1db664..5218dff4 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt @@ -14,7 +14,7 @@ class DeleteClientService( private val userUtil: UserUtil, ) { - @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "redisCacheManager") fun execute(id: Long) { val client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt index 27f8980f..1b5af5a5 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientsService.kt @@ -11,7 +11,7 @@ class DeleteClientsService( private val userUtil: UserUtil ) { - @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "redisCacheManager") fun execute(ids: List) { val user = userUtil.fetchCurrentUser() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt index 3c659a5a..348c3627 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/GetAllClientsService.kt @@ -11,7 +11,7 @@ class GetAllClientsService( private val clientRepository: ClientRepository ) { - @Cacheable(value = ["Clients"], cacheManager = "clientCacheManager") + @Cacheable(value = ["Clients"], cacheManager = "redisCacheManager") fun execute(): List = clientRepository.findByServiceScope(ServiceScope.PUBLIC) .map { SingleClientResDto(it) } diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt index 35f057d5..b9112ba8 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/RegisterClientService.kt @@ -14,7 +14,7 @@ class RegisterClientService( private val userUtil: UserUtil, ) { - @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "redisCacheManager") fun execute(clientRegisterDto: ClientRegisterReqDto): ClientRegisterResDto { val (clientSecret, clientId) = createUUID() to createUUID() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt index 340692d3..cd42130b 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateAnyClientService.kt @@ -13,7 +13,7 @@ class UpdateAnyClientService( private val clientRepository: ClientRepository ) { - @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "redisCacheManager") fun execute(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client: Client = clientRepository.findByIdOrNull(id) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt index fef73057..d80b7a5a 100644 --- a/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt @@ -13,7 +13,7 @@ class UpdateClientService( private val userUtil: UserUtil ) { - @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "clientCacheManager") + @CacheEvict(value = ["Clients"], allEntries = true, cacheManager = "redisCacheManager") fun updateClient(id: Long, clientUpdateReqDto: ClientUpdateReqDto) { val client = clientRepository.findByIdAndCreatedBy(id, userUtil.fetchCurrentUser()) ?: throw ClientNotFindException() diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt index da2b5028..dd56b887 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt @@ -15,7 +15,7 @@ class AcceptUserSignUpService( private val userRoleRepository: UserRoleRepository ) { - @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "userCacheManager") + @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "redisCacheManager") fun execute(id: Long, acceptUserReqDto: AcceptUserReqDto) { val user = userRepository.findByIdAndState(id, UserState.PENDING) ?: throw UserNotFoundException() diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index 2c234319..a1080ee1 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -12,7 +12,7 @@ class GetAcceptedUsersService( private val userRepository: UserRepository, ) { - @Cacheable(value = ["AcceptedUser"], cacheManager = "userCacheManager") + @Cacheable(value = ["AcceptedUser"], cacheManager = "redisCacheManager") fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From d04c3c5d6a306a09d8e846ec0d8abe14a8095b1f Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:17:07 +0900 Subject: [PATCH 18/27] =?UTF-8?q?add=20::=20redis=EC=97=90=20=EC=A0=95?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EC=BA=90=EC=8B=9C=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EC=86=8C=EA=B0=80=20=EB=A7=8C=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EC=A7=80=EA=B2=8C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8c0f0b91..212d0a73 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -16,6 +16,11 @@ spring: password: ${DB_PASSWORD} driver-class-name: ${DB_DRIVER_CLASS} + cache: + type: redis + cache-names: + - Clients + - AcceptedUser redis: host: ${REDIS_HOST} From 58f624007acc07b83ecb3e80265846906ad263e6 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:33:05 +0900 Subject: [PATCH 19/27] =?UTF-8?q?delete=20::=20import=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt index 07db4000..45a2a376 100644 --- a/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt +++ b/src/main/kotlin/com/msg/gauth/global/redis/RedisCacheConfig.kt @@ -4,7 +4,6 @@ import org.springframework.cache.CacheManager import org.springframework.cache.annotation.EnableCaching import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Primary import org.springframework.data.redis.cache.RedisCacheConfiguration import org.springframework.data.redis.cache.RedisCacheManager import org.springframework.data.redis.connection.RedisConnectionFactory From df5a677dd9445dd63655a652de0d1e14d5895eb8 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:08:06 +0900 Subject: [PATCH 20/27] =?UTF-8?q?update=20::=20AcceptUser=20->=20AcceptUse?= =?UTF-8?q?rs=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 212d0a73..ce85e97a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,7 +20,7 @@ spring: type: redis cache-names: - Clients - - AcceptedUser + - AcceptedUsers redis: host: ${REDIS_HOST} From 2fa0c7193891814bd608fd62b7797c0824afff17 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Tue, 17 Sep 2024 22:47:40 +0900 Subject: [PATCH 21/27] =?UTF-8?q?add=20::=20condition=20=EC=86=8D=EC=84=B1?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index a1080ee1..335c98ff 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -12,7 +12,7 @@ class GetAcceptedUsersService( private val userRepository: UserRepository, ) { - @Cacheable(value = ["AcceptedUser"], cacheManager = "redisCacheManager") + @Cacheable(value = ["AcceptedUser"], condition = "#request.grade = 0 && #request.classNum = 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", cacheManager = "redisCacheManager") fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From 5035b5ea7572484a4394c590652414655dcec803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=84=EC=A7=80=EC=84=B1?= <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 22:48:15 +0900 Subject: [PATCH 22/27] Update src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 김태오 <103710151+KimTaeO@users.noreply.github.com> --- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index 335c98ff..e204d704 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -12,7 +12,7 @@ class GetAcceptedUsersService( private val userRepository: UserRepository, ) { - @Cacheable(value = ["AcceptedUser"], condition = "#request.grade = 0 && #request.classNum = 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", cacheManager = "redisCacheManager") + @Cacheable(value = ["AcceptedUser"], condition = "#request.grade == 0 && #request.classNum == 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From 515e287dac09d2486c882257e080d3967f536094 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:19:34 +0900 Subject: [PATCH 23/27] =?UTF-8?q?update=20::=20=EC=8B=A4=EC=88=98=EB=A1=9C?= =?UTF-8?q?=20=EC=A7=80=EC=9A=B4=20cacheManager=20=EB=8B=A4=EC=8B=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index e204d704..6208c7c3 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -12,7 +12,7 @@ class GetAcceptedUsersService( private val userRepository: UserRepository, ) { - @Cacheable(value = ["AcceptedUser"], condition = "#request.grade == 0 && #request.classNum == 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", + @Cacheable(value = ["AcceptedUser"], condition = "#request.grade == 0 && #request.classNum == 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", cacheManager = "redisCacheManager") fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From 51d9ee6a3783cdd37576a152b976c054a13850cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=84=EC=A7=80=EC=84=B1?= <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:28:47 +0900 Subject: [PATCH 24/27] Update src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 김태오 <103710151+KimTaeO@users.noreply.github.com> --- .../msg/gauth/domain/user/service/GetAcceptedUsersService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt index 6208c7c3..3da90a0c 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/GetAcceptedUsersService.kt @@ -12,7 +12,7 @@ class GetAcceptedUsersService( private val userRepository: UserRepository, ) { - @Cacheable(value = ["AcceptedUser"], condition = "#request.grade == 0 && #request.classNum == 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", cacheManager = "redisCacheManager") + @Cacheable(value = ["AcceptedUsers"], condition = "#request.grade == 0 && #request.classNum == 0 && #request.keyword.equals('') && #request.role.equals('ROLE_STUDENT')", cacheManager = "redisCacheManager") fun execute(request: AcceptedUserRequest): List = when (request.role) { UserRoleType.ROLE_STUDENT -> userRepository.search(request.grade, request.classNum, request.keyword) From 702b62b049999391de4c6e1a6a528d81c9c8d08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=84=EC=A7=80=EC=84=B1?= <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:41:25 +0900 Subject: [PATCH 25/27] Update src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 김태오 <103710151+KimTaeO@users.noreply.github.com> --- .../msg/gauth/domain/user/service/AcceptUserSignUpService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt index dd56b887..01c8ef37 100644 --- a/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/user/service/AcceptUserSignUpService.kt @@ -15,7 +15,7 @@ class AcceptUserSignUpService( private val userRoleRepository: UserRoleRepository ) { - @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "redisCacheManager") + @CacheEvict(value = ["AcceptedUsers"], allEntries = true, cacheManager = "redisCacheManager") fun execute(id: Long, acceptUserReqDto: AcceptUserReqDto) { val user = userRepository.findByIdAndState(id, UserState.PENDING) ?: throw UserNotFoundException() From 2a738f834acb20925af7cbdfac6ea27ede447bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=84=EC=A7=80=EC=84=B1?= <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:43:49 +0900 Subject: [PATCH 26/27] Update src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 김태오 <103710151+KimTaeO@users.noreply.github.com> --- .../com/msg/gauth/domain/admin/service/ExcelParsingService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt index de9bcd16..30af71cd 100644 --- a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile class ExcelParsingService( private val userRepository: UserRepository, ) { - @CacheEvict(value = ["AcceptedUser"], allEntries = true, cacheManager = "userCacheManager") + @CacheEvict(value = ["AcceptedUsers"], allEntries = true, cacheManager = "userCacheManager") fun execute(file: MultipartFile) { val tika = Tika() val detect = tika.detect(file.bytes) From ffd00fa07d311e5c6f1179f5542300b4e56917e3 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:45:45 +0900 Subject: [PATCH 27/27] =?UTF-8?q?update=20::=20cacheManager=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 --- .../com/msg/gauth/domain/admin/service/ExcelParsingService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt index 30af71cd..94717f75 100644 --- a/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt +++ b/src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt @@ -20,7 +20,7 @@ import org.springframework.web.multipart.MultipartFile class ExcelParsingService( private val userRepository: UserRepository, ) { - @CacheEvict(value = ["AcceptedUsers"], allEntries = true, cacheManager = "userCacheManager") + @CacheEvict(value = ["AcceptedUsers"], allEntries = true, cacheManager = "redisCacheManager") fun execute(file: MultipartFile) { val tika = Tika() val detect = tika.detect(file.bytes)