Skip to content

Commit

Permalink
Merge pull request #1417 from innovationacademy-kr/be/dev/fix_share_c…
Browse files Browse the repository at this point in the history
…abinet_about_redis_error/#1413

[BE] FIX: fix redis_error
  • Loading branch information
enaenen authored Nov 17, 2023
2 parents 56577db + 0c8f563 commit 49f6424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public void saveUserInRedis(String cabinetId, String userId, String shareCode,
cabinetId); // userId를 key로 하여 cabinetId를 value로 저장
} else { // 초대코드가 틀린 경우
if (valueHashOperations.hasKey(cabinetId, userId)) { // 이미 존재하는 유저인 경우
System.out.println("value : " + valueHashOperations.get(cabinetId, userId));
valueHashOperations.increment(cabinetId, userId, 1L); // trialCount를 1 증가시켜서 저장
} else { // 존재하지 않는 유저인 경우
valueHashOperations.put(cabinetId, userId, "1"); // trialCount를 1로 저장
Expand Down Expand Up @@ -128,8 +127,10 @@ public void deleteShadowKey(Long cabinetId) {

public void deleteUserInRedis(String cabinetId, String userId) { // user를 지우는 delete
log.debug("called deleteUserInRedis: {}, {}", cabinetId, userId);
valueHashOperations.delete(cabinetId, userId);
valueOperations.getOperations().delete(userId + VALUE_KEY_SUFFIX);
if (isUserInRedis(cabinetId, userId)) {
valueHashOperations.delete(cabinetId, userId);
valueOperations.getOperations().delete(userId + VALUE_KEY_SUFFIX);
}
}

public void deleteCabinetIdInRedis(String cabinetId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ public void startLentShareCabinet(Long userId, Long cabinetId, String shareCode)
saveLentHistories(now, cabinetId);
// cabinetId에 대한 shadowKey, valueKey 삭제
lentRedis.deleteShadowKey(cabinetId);
// lentRedis.deleteUserIdInRedis(cabinetId);
ArrayList<String> userIds = lentRedis.getUserIdsByCabinetIdInRedis(
cabinetId.toString());
for (String id : userIds) {
Expand Down

0 comments on commit 49f6424

Please sign in to comment.