Skip to content

Commit

Permalink
feat: 채팅 목록 조회에 로컬 캐시 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Curry4182 committed Apr 6, 2024
1 parent fabdb9f commit 18ad8d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 18ad8d6

Please sign in to comment.