-
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.
feat: 채팅 목록 조회 데이터 프리워밍(Pre-warming) 적용
- Loading branch information
Showing
5 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
lime-api/src/main/java/com/programmers/lime/global/event/chat/ChatInitCacheEvent.java
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,10 @@ | ||
package com.programmers.lime.global.event.chat; | ||
|
||
import java.util.List; | ||
|
||
import com.programmers.lime.domains.chatroom.model.ChatRoomInfo; | ||
|
||
public record ChatInitCacheEvent( | ||
List<ChatRoomInfo> chatRoomInfos | ||
) { | ||
} |
31 changes: 31 additions & 0 deletions
31
...api/src/main/java/com/programmers/lime/global/initializer/ChatCursorCacheInitializer.java
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,31 @@ | ||
package com.programmers.lime.global.initializer; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.boot.ApplicationArguments; | ||
import org.springframework.boot.ApplicationRunner; | ||
import org.springframework.context.ApplicationEventPublisher; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.programmers.lime.domains.chatroom.implementation.ChatRoomReader; | ||
import com.programmers.lime.domains.chatroom.model.ChatRoomInfo; | ||
import com.programmers.lime.global.event.chat.ChatInitCacheEvent; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class ChatCursorCacheInitializer implements ApplicationRunner { | ||
|
||
private final ChatRoomReader chatRoomReader; | ||
|
||
private final ApplicationEventPublisher eventPublisher; | ||
|
||
@Override | ||
public void run(final ApplicationArguments args) { | ||
List<ChatRoomInfo> chatRoomInfos = chatRoomReader.readOpenChatRoomsByMemberId(null); | ||
|
||
ChatInitCacheEvent chatInitCacheEvent = new ChatInitCacheEvent(chatRoomInfos); | ||
eventPublisher.publishEvent(chatInitCacheEvent); | ||
} | ||
} |
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