forked from wine-area/DMS-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
72 additions
and
23 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
dms-core/src/main/kotlin/team/aliens/dms/common/model/SchoolSecret.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
package team.aliens.dms.common.model | ||
|
||
import java.io.Serializable | ||
import java.util.UUID | ||
|
||
data class SchoolSecret( | ||
val schoolId: UUID, | ||
val secretKey: String | ||
) : Serializable | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
dms-infrastructure/src/main/kotlin/team/aliens/dms/global/config/CacheConfig.kt
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
dms-infrastructure/src/main/kotlin/team/aliens/dms/global/config/RedisCacheConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package team.aliens.dms.global.config | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import java.time.Duration | ||
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.RedisCacheManagerBuilder | ||
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 | ||
|
||
|
||
@Configuration | ||
@EnableCaching | ||
class RedisCacheConfig { | ||
|
||
@Bean | ||
fun redisCacheManager( | ||
connectionFactory: RedisConnectionFactory, | ||
objectMapper: ObjectMapper, | ||
): CacheManager { | ||
|
||
val redisCacheConfiguration = RedisCacheConfiguration | ||
.defaultCacheConfig() | ||
.serializeKeysWith( | ||
RedisSerializationContext.SerializationPair.fromSerializer(StringRedisSerializer()) | ||
) | ||
.serializeValuesWith( | ||
RedisSerializationContext.SerializationPair.fromSerializer(GenericJackson2JsonRedisSerializer()) | ||
) | ||
.entryTtl(CACHE_DURATION) | ||
|
||
return RedisCacheManagerBuilder | ||
.fromConnectionFactory(connectionFactory) | ||
.cacheDefaults(redisCacheConfiguration) | ||
.build() | ||
} | ||
|
||
companion object { | ||
private val CACHE_DURATION = Duration.ofMinutes(30L) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters