Skip to content

Commit

Permalink
Fix: 유저 캐싱 부분 수정 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sieunnnn committed Nov 11, 2023
1 parent 923915b commit cc5e2cb
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public class UserInfoService {
private final UserRepository userRepository;
private final AuthUtil authUtil;

@Cacheable(value = "userInfo", key = "#userId")
@Cacheable(value = "userInfo", key = "@authUtil.getLoginUserIndex()")
public UserDTO getUserById() {
Long userId = authUtil.getLoginUserIndex();
return userRepository.findById(userId)
.map(this::toDTO)
.orElseThrow(() -> new ApiException(ErrorType.USER_NOT_FOUND));
}

@CachePut(value = "userInfo", key = "#userId")
@CachePut(value = "userInfo", key = "@authUtil.getLoginUserIndex()")
public UserDTO reloadUser() {
Long userId = authUtil.getLoginUserIndex();
return userRepository.findById(userId)
Expand Down

0 comments on commit cc5e2cb

Please sign in to comment.