Skip to content

FEATURE: Add CompletableFuture Map-based multiStore APIs#1056

Open
f1v3-dev wants to merge 1 commit intonaver:developfrom
f1v3-dev:feat/multi-store
Open

FEATURE: Add CompletableFuture Map-based multiStore APIs#1056
f1v3-dev wants to merge 1 commit intonaver:developfrom
f1v3-dev:feat/multi-store

Conversation

@f1v3-dev
Copy link
Collaborator

@f1v3-dev f1v3-dev commented Mar 9, 2026

🔗 Related Issue

⌨️ What I did

  • 다건 저장 (multiSet, multiAdd, multiReplace) API를 구현합니다.
    • Key-Value 쌍인 Map을 기반으로 저장 명령을 수행합니다.

@f1v3-dev f1v3-dev requested a review from oliviarla March 9, 2026 05:24
@f1v3-dev f1v3-dev self-assigned this Mar 9, 2026
@f1v3-dev f1v3-dev force-pushed the feat/multi-store branch 3 times, most recently from e7dacd6 to 4e1634a Compare March 11, 2026 06:19
* @param exp expiration time in seconds
* @return Map of key to Boolean result
*/
ArcusFuture<Map<String, Boolean>> multiSet(Map<String, T> keyValueMap, int exp);
Copy link
Collaborator

Choose a reason for hiding this comment

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

전체적으로 keyValueMap -> elements로 표현해도 충분할 것 같습니다.

}

@Test
void multiSetSuccess() throws ExecutionException, InterruptedException, TimeoutException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

multiSetSuccess -> multiSetMapSuccess

Comment on lines +262 to +272
return new ArcusMultiFuture<>(keyToFuture.values(), () -> {
Map<String, Boolean> results = new HashMap<>();
for (Map.Entry<String, CompletableFuture<?>> entry : keyToFuture.entrySet()) {
if (entry.getValue().isCompletedExceptionally()) {
results.put(entry.getKey(), null);
} else {
results.put(entry.getKey(), (Boolean) entry.getValue().join());
}
}
return results;
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

기존 multiStore과 중복되는 부분인데 별도 메서드화하여 중복을 줄일 수 있을까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아래 코드와 같은 buildMultiFuture() 메서드로 공통 로직을 추출하여 중복을 줄일 수 있을 것 같습니다.

  private ArcusMultiFuture<Map<String, Boolean>> buildMultiFuture(Map<String, CompletableFuture<?>> keyToFuture) {
    return new ArcusMultiFuture<>(keyToFuture.values(), () -> {
      //...
      }
      return results;
    });
  }

for (int i = 0; i < 2; i++) {
assertEquals(VALUE + "-new-" + i, result.get(keys.get(i)));
}
// 캐시에 아예 없어야 하므로 맵에서 꺼냈을 때 null이 나와야 합니다.
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기 주석은 제외해도 되겠습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants