Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Redis Key Name 난잡한 상황 개선 (#129) #132

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

win-luck
Copy link
Collaborator

#️⃣ 연관 이슈

📝 작업 내용

이제 선착순 이벤트와 관련된 Redis의 key의 의미를 명확하게 표현하도록 수정했습니다.

기존에는 단순 숫자와 suffix만으로 key를 만들었기 때문에 만약 다른 기능에서 유사한 구조의 key가 도입될 경우 난잡해질 수 있다는 단점이 있었습니다.

참고 이미지 및 자료

image image

💬 리뷰 요구사항

@win-luck win-luck added the chore 개발과 직접적인 관련이 없음 label Aug 22, 2024
@win-luck win-luck requested a review from blaxsior August 22, 2024 03:17
@win-luck win-luck self-assigned this Aug 22, 2024
@win-luck win-luck linked an issue Aug 22, 2024 that may be closed by this pull request
Copy link
Collaborator Author

@win-luck win-luck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

남은 시간 동안 잔여 버그를 수정하고, SonarLint 정적분석 도구를 통해 불필요한 코드나 구조를 개선하겠습니다.

Comment on lines -24 to 42
// 선착순 이벤트 마감 여부 tag
public static String endFlagFormatting(String key) {
return key + ":end";
return formatKey(key, "end");
}

// 선착순 이벤트 당첨자 tag
public static String winnerFormatting(String key) {
return key + ":winner";
return formatKey(key, "winner");
}

// 선착순 이벤트 참여자 tag
public static String participantFormatting(String key) {
return key + ":participant";
return formatKey(key, "participant");
}

// 선착순 이벤트 정답 tag
public static String answerFormatting(String key) {
return key + ":answer";
return formatKey(key, "answer");
}

// 공통 로직을 처리하는 메서드
private static String formatKey(String key, String suffix) {
return FCFS_PREFIX + key + ":" + suffix;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존의 key는 [숫자]:[역할]로 구성되어 확장성이 떨어졌기에, 별도의 PREFIX를 추가하여 의미를 명확하게 하고자 했습니다.

Comment on lines -14 to 17
// 선착순 이벤트 tag
public static String keyFormatting(String key) {
return key + ":fcfs";
return formatKey(key, "count");
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한편, 기존 2:fcfs 형태의 key는 참여 가능한 사람 수를 저장하는 용도였는데, fcfs:2:fcfs와 같은 어색한 표현을 피하고자 count로 명확하게 수정했습니다.

Copy link
Collaborator

@blaxsior blaxsior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다. redis 키 이름을 처음 봤을 때 차후 이해하기 어려울 수도 있을 것이라 생각했는데, fcfs prefix를 추가해서 이전보다 더 redis에 들어가는 데이터의 의미가 명확해진 것 같습니다.

@win-luck win-luck merged commit ab11004 into dev Aug 22, 2024
1 check passed
@win-luck win-luck deleted the feature/129-fix-rediskey branch August 22, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore 개발과 직접적인 관련이 없음
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chore] Redis Key Name 난잡한 상황 개선 (#129)
2 participants