Skip to content

Commit

Permalink
refactor: redisRepository 메서드 파라미터 변경
Browse files Browse the repository at this point in the history
기존 save() 메서드 내부에서 자체적으로 TimeUnit을 설정했으나, 사용하는 쪽에서 주입하도록 변경
  • Loading branch information
jemin committed Jan 28, 2024
1 parent b2fc9c3 commit de376e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static cmc.mellyserver.auth.certificate.CertificateConstants.*;

import java.util.concurrent.TimeUnit;

import org.springframework.stereotype.Repository;

import cmc.mellyserver.dbredis.repository.RedisRepository;
Expand All @@ -14,7 +16,8 @@ class CertificationNumberDao {
private final RedisRepository repository;

public void save(String email, String certificationNumber) {
repository.save(PREFIX_CERTIFICATION + email, certificationNumber, LIMIT_TIME_CERTIFICATION_NUMBER);
repository.save(PREFIX_CERTIFICATION + email, certificationNumber, LIMIT_TIME_CERTIFICATION_NUMBER,
TimeUnit.MILLISECONDS);
}

public String get(String email) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

import org.springframework.stereotype.Component;

Expand All @@ -18,11 +19,11 @@ public class AuthTokenDao {

public void saveRefreshToken(RefreshToken refreshToken, Long refreshTokenExpiredTime) {
repository.save(REFRESH_TOKEN_PREFIX + refreshToken.userId(), refreshToken.refreshToken(),
refreshTokenExpiredTime);
refreshTokenExpiredTime, TimeUnit.MILLISECONDS);
}

public void makeAccessTokenDisabled(String accessToken, long lastExpiredTime) {
repository.save(accessToken, ACCESS_TOKEN_BLACKLIST, lastExpiredTime);
repository.save(accessToken, ACCESS_TOKEN_BLACKLIST, lastExpiredTime, TimeUnit.MILLISECONDS);
}

public Optional<RefreshToken> findRefreshToken(Long userId) {
Expand Down

0 comments on commit de376e9

Please sign in to comment.