From ad32544e653c1f1f17b83007f39e43249b02ba39 Mon Sep 17 00:00:00 2001 From: ch8930 Date: Wed, 10 Jul 2024 13:38:28 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20TT-118=20Redis=20conflict=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20=EA=B8=B0=EC=A1=B4=EC=9D=98=20=EA=B0=81?= =?UTF-8?q?=EC=9E=90=EA=B0=80=20=EC=9E=91=EC=84=B1=ED=95=9C=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20conflict=20convention=EC=9D=84=20=EB=A7=9E=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../twentythree/peech/script/cache/CacheService.java | 2 -- .../peech/script/cache/RedisTemplateImpl.java | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/twentythree/peech/script/cache/CacheService.java b/src/main/java/com/twentythree/peech/script/cache/CacheService.java index 74a6c9ca..8f322395 100644 --- a/src/main/java/com/twentythree/peech/script/cache/CacheService.java +++ b/src/main/java/com/twentythree/peech/script/cache/CacheService.java @@ -14,6 +14,4 @@ public interface CacheService { List findAllByUserKey(String userKey); RedisSentenceDTO findByKey(Long sentenceId); - - void setKeySentenceIdValueSentenceInformations(Long sentenceId, RedisSentenceDTO redisSentence); } diff --git a/src/main/java/com/twentythree/peech/script/cache/RedisTemplateImpl.java b/src/main/java/com/twentythree/peech/script/cache/RedisTemplateImpl.java index 3e1323b1..2f3a2f3d 100644 --- a/src/main/java/com/twentythree/peech/script/cache/RedisTemplateImpl.java +++ b/src/main/java/com/twentythree/peech/script/cache/RedisTemplateImpl.java @@ -57,5 +57,15 @@ public void saveSentenceInfo(Long sentenceId, RedisSentenceDTO redisSentence){ throw new RuntimeException("Error saving redisSentence List: " + sentenceId); } } + + @Override + public List findAllByUserKey(String userKey) { + return List.of(); + } + + @Override + public RedisSentenceDTO findByKey(Long sentenceId) { + return null; + } } From cd567ffb9b538657afd63e83b6a3538f26207be4 Mon Sep 17 00:00:00 2001 From: snacktime Date: Wed, 10 Jul 2024 14:18:30 +0900 Subject: [PATCH 2/2] =?UTF-8?q?TT-221=20modify=20script=20redis=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../twentythree/peech/script/service/ScriptService.java | 7 ++++--- .../peech/script/service/ScriptRedisTemplateImplTest.java | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/twentythree/peech/script/service/ScriptService.java b/src/main/java/com/twentythree/peech/script/service/ScriptService.java index d74132f0..f17b89b9 100644 --- a/src/main/java/com/twentythree/peech/script/service/ScriptService.java +++ b/src/main/java/com/twentythree/peech/script/service/ScriptService.java @@ -2,6 +2,7 @@ import com.twentythree.peech.common.dto.request.GPTRequest; import com.twentythree.peech.common.dto.response.GPTResponse; +import com.twentythree.peech.script.cache.CacheService; import com.twentythree.peech.script.domain.*; import com.twentythree.peech.script.dto.*; import com.twentythree.peech.script.dto.response.MajorScriptsResponseDTO; @@ -38,7 +39,7 @@ public class ScriptService { private final ThemeRepository themeRepository; private final VersionRepository versionRepository; private final SentenceRepository sentenceRepository; - private final ScriptInMemoryRepository scriptRedisRepository; + private final CacheService scriptRedisRepository; @Transactional public SaveScriptDTO saveInputScript(Long themeId, String[] paragraphs) { @@ -206,11 +207,11 @@ public ModifyScriptResponseDTO modifyScriptService(List modifiedPa Long newSentenceId = redisSentenceMap.getKey().getSentenceId(); RedisSentenceDTO newSentence = redisSentenceMap.getValue(); - scriptRedisRepository.setKeySentenceIdValueSentenceInformations(newSentenceId, newSentence); + scriptRedisRepository.saveSentenceInfo(newSentenceId, newSentence); newSentenceIds.add(newSentenceId); } - scriptRedisRepository.setKeyUserValueSentenceIds("user"+userId, newSentenceIds); + scriptRedisRepository.saveSentencesIdList("user"+userId, newSentenceIds); } return new ModifyScriptResponseDTO(modifiedParagraphList); diff --git a/src/test/java/com/twentythree/peech/script/service/ScriptRedisTemplateImplTest.java b/src/test/java/com/twentythree/peech/script/service/ScriptRedisTemplateImplTest.java index f89092d5..8f694530 100644 --- a/src/test/java/com/twentythree/peech/script/service/ScriptRedisTemplateImplTest.java +++ b/src/test/java/com/twentythree/peech/script/service/ScriptRedisTemplateImplTest.java @@ -2,6 +2,7 @@ import com.twentythree.peech.script.cache.RedisTemplateImpl; import com.twentythree.peech.script.dto.SaveRedisSentenceInfoDto; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -39,6 +40,7 @@ public class ScriptRedisTemplateImplTest { } @Test + @Disabled public void 문장_정보_저장() throws Exception { List sentencesInfoList = List.of( new SaveRedisSentenceInfoDto(1L, 1L, 1L, "sentence1", 1L, LocalTime.of(0, 0, 12), false),