From 18ad8d6d219db7c618e0c2eefd44ec05592410ab Mon Sep 17 00:00:00 2001 From: Curry4182 Date: Sat, 6 Apr 2024 19:00:49 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B1=84=ED=8C=85=20=EB=AA=A9=EB=A1=9D?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=EC=97=90=20=EB=A1=9C=EC=BB=AC=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../programmers/lime/domains/chat/application/ChatService.java | 2 ++ .../main/java/com/programmers/lime/global/cache/CacheType.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lime-api/src/main/java/com/programmers/lime/domains/chat/application/ChatService.java b/lime-api/src/main/java/com/programmers/lime/domains/chat/application/ChatService.java index 16546534..cb496a22 100644 --- a/lime-api/src/main/java/com/programmers/lime/domains/chat/application/ChatService.java +++ b/lime-api/src/main/java/com/programmers/lime/domains/chat/application/ChatService.java @@ -5,6 +5,7 @@ import java.time.ZoneId; import java.util.List; +import org.springframework.cache.annotation.Cacheable; import org.springframework.context.ApplicationEventPublisher; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Service; @@ -126,6 +127,7 @@ public void sendExitMessageToChatRoom(final Long chatRoomId) { simpMessagingTemplate.convertAndSend("/subscribe/rooms/exit/" + chatRoomId, chatInfoWithMember); } + @Cacheable(value = "chat", key = "#chatRoomId + '_' + #parameters.cursorId + '_' + #parameters.size") public ChatGetCursorServiceResponse getChatByCursor( final Long chatRoomId, final CursorPageParameters parameters diff --git a/lime-api/src/main/java/com/programmers/lime/global/cache/CacheType.java b/lime-api/src/main/java/com/programmers/lime/global/cache/CacheType.java index 415eb3e4..61aec554 100644 --- a/lime-api/src/main/java/com/programmers/lime/global/cache/CacheType.java +++ b/lime-api/src/main/java/com/programmers/lime/global/cache/CacheType.java @@ -7,7 +7,8 @@ @RequiredArgsConstructor public enum CacheType { - REFRESH_TOKEN("refreshToken", 1209600, 10000); + REFRESH_TOKEN("refreshToken", 1209600, 10000), + CHAT_CACHE("chat", 24 * 3600, 500000); private final String cacheName; private final int expireAfterWrite;