forked from Loopers-dev-lab/loop-pack-be-l2-vol2-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRankingKey.java
More file actions
32 lines (24 loc) · 808 Bytes
/
RankingKey.java
File metadata and controls
32 lines (24 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.loopers.domain.ranking;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* Redis ZSET 키 생성 유틸리티
*/
public class RankingKey {
private static final String KEY_PREFIX = "ranking:all:";
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
private RankingKey() {
}
public static String daily(LocalDate date) {
return KEY_PREFIX + date.format(DATE_FORMATTER);
}
public static String today() {
return daily(LocalDate.now());
}
public static String fromDateString(String dateString) {
return KEY_PREFIX + dateString;
}
public static LocalDate parseDate(String dateString) {
return LocalDate.parse(dateString, DATE_FORMATTER);
}
}