From 778bacdc9158225f85e939c0a686cba2192c43e9 Mon Sep 17 00:00:00 2001 From: esperar Date: Tue, 10 Dec 2024 08:56:56 +0900 Subject: [PATCH 1/2] fix :: cache music expried --- .../v2/global/config/redis/service/RedisCacheService.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/dotori/v2/global/config/redis/service/RedisCacheService.kt b/src/main/kotlin/com/dotori/v2/global/config/redis/service/RedisCacheService.kt index f96392a4..0ceab0bb 100644 --- a/src/main/kotlin/com/dotori/v2/global/config/redis/service/RedisCacheService.kt +++ b/src/main/kotlin/com/dotori/v2/global/config/redis/service/RedisCacheService.kt @@ -16,11 +16,8 @@ class RedisCacheService( fun putToCache(key: String, value: Any) { redisTemplate.opsForValue().set(key, value) - if (key == "memberList") { + if (key == "memberList") redisTemplate.expire(key, 1, TimeUnit.HOURS) - } else if(key.startsWith("musicList")) { - redisTemplate.expire(key, 10, TimeUnit.MINUTES) - } } fun deleteFromCache(key: String) { @@ -28,7 +25,9 @@ class RedisCacheService( } fun putToCacheMusic(date: String, value: Any) { - redisTemplate.opsForValue().set("musicList:$date", value) + val key = "musicList:$date" + redisTemplate.opsForValue().set(key, value) + redisTemplate.expire(key, 10, TimeUnit.MINUTES) } fun getFromCacheMusic(date: String): Any? { From 73e40b19f4fa5740605c7d525baaf29f398ceda5 Mon Sep 17 00:00:00 2001 From: esperar Date: Tue, 10 Dec 2024 08:58:11 +0900 Subject: [PATCH 2/2] application set --- src/main/kotlin/com/dotori/v2/V2Application.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/com/dotori/v2/V2Application.kt b/src/main/kotlin/com/dotori/v2/V2Application.kt index 2f4456c1..b9116b39 100644 --- a/src/main/kotlin/com/dotori/v2/V2Application.kt +++ b/src/main/kotlin/com/dotori/v2/V2Application.kt @@ -7,7 +7,6 @@ import java.util.* import javax.annotation.PostConstruct @SpringBootApplication -// @EnableBatchProcessing class V2Application{ val log = LoggerFactory.getLogger(this::class.java.name)!!