-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INTERNAL: add builder and transaction for ArcusCacheManager #98
Conversation
@oliviarla |
src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheManager.java
Outdated
Show resolved
Hide resolved
src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheManagerBuilderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheManagerBuilderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheManagerBuilderTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/navercorp/arcus/spring/cache/ArcusCacheManagerBuilderTest.java
Outdated
Show resolved
Hide resolved
Spring Transaction에 의해 관리될 수 있도록 하는 것이 목적입니다. ArcusCache의 put, evict, clear 메서드가 호출되었을 때 Spring 트랜잭션의 커밋 후에 수행되도록 합니다. 참고로 Spring Transaction의 커밋 시점에 맞추어 작업이 수행되도록 지정할 수 있는데요, beforeCommit, beforeCompletion, afterCommit(AbstractTransactionSupportingCacheManager를 통해 적용하는 시점), afterCompletion 네 가지 시점에 수행되도록 설정할 수 있습니다. 현재 타사 Cache 구현체들에서는 대부분 이를 상속받고 있습니다. |
f2bbb1d
to
537b019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일부 리뷰
public Set<String> getConfiguredCaches() { | ||
return Collections.unmodifiableSet(this.initialCaches.keySet()); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아래 두 메소드는 없어도 될 것 같은데요. 필요한 데가 있나요?
- getCacheConfigurationFor()
- getConfiguredCaches()
public ArcusCacheManagerBuilder cacheDefaults(ArcusCacheConfiguration defaultCacheConfiguration) { | ||
this.defaultConfiguration = defaultCacheConfiguration; | ||
return this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메소드 명 : defaultCacheConfiguration() or defaultConfiguration() ??
public ArcusCacheManagerBuilder defaultCacheConfiguration(ArcusCacheConfiguration cacheConfiguration) {
this.defaultConfiguration = cacheConfiguration;
return this;
}
public ArcusCacheManagerBuilder defaultConfiguration(ArcusCacheConfiguration configuration) {
this.defaultConfiguration = configuration;
return this;
}
return this; | ||
} | ||
|
||
public ArcusCacheManagerBuilder initialCacheNames(Set<String> cacheNames) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- initialCacheNames() vs initialCaches()
아래의 다른 메소드까지 고려한다면
- withInitialCachesWithDefault()
- withInitialCacheWithConfig()
- withInitialCachesWithConfig()
이름을 만드는 것이 힘드네요.
.initialCacheNames(Collections.singleton("first-cache")) | ||
.cacheDefaults(withoutPrefix) | ||
.initialCacheNames(Collections.singleton("second-cache")) | ||
.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아래 코드 형태를 생각해 보았을 것으로 생각합니다.
하지만, 위의 코드를 넣은 것은 cacheDefaults()의 다양한 활용 예를 보이려는 의도인가요?
ArcusCacheManager cm = ArcusCacheManager.builder(arcusClientPool)
.withCacheConfiguration("first-cache", withPrefix)
.withCacheConfiguration("second-cache", withoutPrefix)
.build();
@@ -41,6 +41,12 @@ public class ArcusCacheConfiguration implements InitializingBean { | |||
private boolean forceFrontCaching; | |||
private boolean allowNullValues = ArcusCache.DEFAULT_ALLOW_NULL_VALUES; | |||
|
|||
public static ArcusCacheConfiguration defaultCacheConfig() { | |||
ArcusCacheConfiguration config = new ArcusCacheConfiguration(); | |||
config.setServiceId(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setServiceId() 수행하지 않으면 어떻게 되나요?
@oliviarla
|
🔗 Related Issue
⌨️ What I did