Skip to content
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: provide meaningful methods instead of setters in ArcusCacheConfiguration #101

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 46 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,10 @@ public class ArcusConfiguration extends CachingConfigurerSupport {

@Bean
public ArcusCacheConfiguration defaultCacheConfig() {
ArcusCacheConfiguration defaultCacheConfig = new ArcusCacheConfiguration();
defaultCacheConfig.setPrefix("DEFAULT");
defaultCacheConfig.setExpireSeconds(60);
defaultCacheConfig.setTimeoutMilliSeconds(800);
return defaultCacheConfig;
return new ArcusCacheConfiguration()
.withPrefix("DEFAULT")
.withExpireSeconds(60)
.withTimeoutMilliSeconds(800);
}

@Bean
Expand All @@ -168,22 +167,20 @@ public class ArcusConfiguration extends CachingConfigurerSupport {

@Bean
public ArcusCacheConfiguration testCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("TEST-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(60);
cacheConfig.setTimeoutMilliSeconds(800);
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("TEST-")
.withPrefix("PRODUCT")
.withExpireSeconds(60)
.withTimeoutMillisSeconds(800);
}

@Bean
public ArcusCacheConfiguration devCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("DEV-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(120);
cacheConfig.setTimeoutMilliSeconds(800);
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("DEV-")
.withPrefix("PRODUCT")
.withExpireSeconds(120)
.withTimeoutMillisSeconds(800);
}

}
Expand Down Expand Up @@ -234,32 +231,30 @@ You can use the front cache to provide fast responsiveness of cache requests. Th
```java
@Bean
public ArcusCacheConfiguration testCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("TEST-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(60);
cacheConfig.setTimeoutMilliSeconds(800);
/* front cache configuration */
cacheConfig.setArcusFrontCache(testArcusFrontCache());
cacheConfig.setFrontExpireSeconds(120);
cacheConfig.setForceFrontCaching(false);
/* front cache configuration */
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("TEST-")
.withPrefix("PRODUCT")
.withExpireSeconds(60)
.withTimeoutMilliSeconds(800)
/* front cache configuration */
.withArcusFrontCache(testArcusFrontCache())
.withFrontExpireSeconds(120)
.enableForcingFrontCache();
/* front cache configuration */
}

@Bean
public ArcusCacheConfiguration devCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("DEV-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(120);
cacheConfig.setTimeoutMilliSeconds(800);
/* front cache configuration */
cacheConfig.setArcusFrontCache(devArcusFrontCache());
cacheConfig.setFrontExpireSeconds(240);
cacheConfig.setForceFrontCaching(true);
/* front cache configuration */
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("DEV-")
.withPrefix("PRODUCT")
.withExpireSeconds(120)
.withTimeoutMilliSeconds(800)
/* front cache configuration */
.withArcusFrontCache(devArcusFrontCache())
.withFrontExpireSeconds(240)
.enableForcingFrontCache();
/* front cache configuration */
}

@Bean
Expand All @@ -273,16 +268,19 @@ public ArcusFrontCache devArcusFrontCache() {
}
```

The properties added to the `ArcusCache` class related to Front Cache are as follows.
The properties added to the `ArcusCacheConfiguration` class related to Front Cache are as follows.

- `withArcusFrontCache(ArcusFrontCache arcusFrontCache)`
- Set the ArcusFrontCache object to enable Front Caching.
- The DefaultArcusFrontCache class provided by Arcus Spring can be used.
- Front caching is disabled by default and arguments cannot be set to null.
- `withFrontExpireSeconds(int frontExpireSeconds)`
- Set Front Cache TTL(TimeToLive).
- `enableForcingFrontCache()`, `disableForcingFrontCache()`
- Set whether to perform Front Cache regardless of success or failure of ARCUS change request(put, delete, clear).
- It is prone to data consistency issues, so we recommend using it only for data that doesn't change frequently.
- It is disabled by default.

- `setArcusFrontCache(ArcusFrontCache arcusFrontCache)`
- Front Cache instance setting. If it is a null value, Front Cache does not work.
- `setFrontExpireSeconds(int frontExpireSeconds)`
- Front Cache TTL(TimeToLive) setting.
- `setForceFrontCaching(int forceFrontCaching)`
- true: Even if the change request of ARCUS fails, the change request is reflected in Front Cache. When a request fails due to an ARCUS failure, the Front Cache function can be worked. But, it is prone to data consistency issues, so we recommend using it only for data that doesn't change frequently.
- false: If the change request of ARCUS fails, the change request is not reflected in Front Cache.

Front Caching is not always performed. It is performed depending on the attribute of `forceFrontCaching` property and the result of the ARCUS request.

| ArcusCache API | ARCUS Result | forceFrontCaching=false | forceFrontCaching=true |
Expand Down
55 changes: 34 additions & 21 deletions docs/02-arcus-spring-concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,39 @@ ArcusCache ๊ฐ์ฒด๋Š” String ํƒ€์ž…์˜ ์บ์‹œ ์ด๋ฆ„๊ณผ ArcusCacheConfiguration

ArcusCache ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” ์บ์‹œ ์„ค์ • ํด๋ž˜์Šค์ด๋‹ค.

์‚ฌ์šฉ์ž๊ฐ€ ์ง์ ‘ ArcusCacheConfiguration ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ  Setter ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ์บ์‹œ ์„ค์ •์„ ์กฐ์ •ํ•œ ๋’ค, ArcusCacheManager ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์ƒ์„ฑ์ž์˜ ์ธ์ž๋กœ ๋„˜๊ฒจ์ฃผ๋ฉด ๋œ๋‹ค.
ArcusCacheConfiguration ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์•„๋ž˜ ๋ฉ”์†Œ๋“œ๋ฅผ ํ†ตํ•ด ์†์„ฑ์„ ์„ค์ •ํ•œ ๋’ค, ArcusCacheManager ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์ƒ์„ฑ์ž์˜ ์ธ์ž๋กœ ๋„˜๊ฒจ์ฃผ๋ฉด ๋œ๋‹ค.
๋ชจ๋“  ์†์„ฑ์„ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์ธ์ž๊ฐ€ ์—†๋Š” ์ƒ์„ฑ์ž๋กœ ์ƒ์„ฑํ•œ ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

์บ์‹œ ํ‚ค์— ๋“ค์–ด๊ฐˆ Prefix, ์บ์‹œ ์•„์ดํ…œ์˜ Expire Time, ๋น„๋™๊ธฐ ์—ฐ์‚ฐ์˜ Timeout์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

- `String serviceId`
- ๋‹ค์Œ์— ์„ค๋ช…ํ•  prefix์™€ ์กฐํ•ฉํ•˜์—ฌ ์บ์‹œ ํ‚ค์˜ Prefix๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.
- ๋ฐฐํฌ ๋‹จ๊ณ„(test, dev, stage, prod, ...)๋ฅผ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•œ ๋ฌธ์ž์—ด์„ ์ง€์ •ํ•œ๋‹ค.
- `withServiceId(String serviceId)`
- ๋‹ค์Œ์— ์„ค๋ช…ํ•  prefix์™€ ์กฐํ•ฉํ•˜์—ฌ ์บ์‹œ ํ‚ค์˜ Prefix๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์‚ฌ์šฉ๋˜๋Š” serviceId๋ฅผ ์ง€์ •ํ•œ๋‹ค.
- ์ธ์ž๋กœ null์„ ์ž…๋ ฅํ•  ์ˆ˜ ์—†์œผ๋ฉฐ, ๋ณดํ†ต ๋ฐฐํฌ ๋‹จ๊ณ„(test, dev, stage, prod, ...)๋ฅผ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•œ ๋ฌธ์ž์—ด์— `-`๋ฅผ ๋ถ™์—ฌ ์ง€์ •ํ•œ๋‹ค. ex) "DEV-"
- [1์žฅ์˜ Cache Key ์„ค๋ช…](01-arcus-cache-basics.md#cache-key)์„ ์ฐธ๊ณ ํ•˜์—ฌ ARCUS Cache์˜ ์บ์‹œ ํ‚ค๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ๋ฌธ์ž์—ด์ด ํฌํ•จ๋˜์ง€ ์•Š๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.
- `String prefix`
- `withPrefix(String prefix)`
- serviceId์™€ ์กฐํ•ฉํ•˜์—ฌ ์บ์‹œ ํ‚ค์˜ Prefix๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋œ๋‹ค.
- ์ฃผ๋กœ ARCUS Cache์— ์ €์žฅํ•  ๊ฐ์ฒด์˜ ์ข…๋ฅ˜(Product, User, Order, ...)๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฌธ์ž์—ด์„ ์ง€์ •ํ•œ๋‹ค.
- ํ•„์ˆ˜์ ์œผ๋กœ ์ง€์ •ํ•˜์ง€ ์•Š์•„๋„ ๋˜๋ฉฐ, ์ด ๊ฒฝ์šฐ ์บ์‹œ ํ‚ค์˜ Prefix๋ฅผ ์ƒ์„ฑํ•  ๋•Œ serviceId์™€ ํ˜„์žฌ ์บ์‹œ ์„ค์ •์œผ๋กœ ์ƒ์„ฑํ•˜๋Š” ArcusCache ๊ฐ์ฒด์˜ ์บ์‹œ ์ด๋ฆ„์ด ์‚ฌ์šฉ๋œ๋‹ค.
- null์ด ์•„๋‹Œ ๊ฐ’์„ ์ง€์ •ํ•˜๋Š” ๊ฒฝ์šฐ, [1์žฅ์˜ Cache Key ์„ค๋ช…](01-arcus-cache-basics.md#cache-key)์„ ์ฐธ๊ณ ํ•˜์—ฌ ARCUS Cache์˜ ์บ์‹œ ํ‚ค๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ๋ฌธ์ž์—ด์ด ํฌํ•จ๋˜์ง€ ์•Š๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.
- `int expireSeconds`
- ์ด ๋ฉ”์„œ๋“œ๋กœ prefix๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ์บ์‹œ ํ‚ค์˜ Prefix๋ฅผ ์ƒ์„ฑํ•  ๋•Œ serviceId์™€ ํ˜„์žฌ ์บ์‹œ ์„ค์ • ๊ฐ์ฒด๋ฅผ ๋‹ด์€ ArcusCache ๊ฐ์ฒด์˜ ์บ์‹œ ์ด๋ฆ„์ด ์‚ฌ์šฉ๋œ๋‹ค.
- ์ธ์ž๋กœ null์„ ์ž…๋ ฅํ•  ์ˆ˜ ์—†์œผ๋ฉฐ, [1์žฅ์˜ Cache Key ์„ค๋ช…](01-arcus-cache-basics.md#cache-key)์„ ์ฐธ๊ณ ํ•˜์—ฌ ARCUS Cache์˜ ์บ์‹œ ํ‚ค๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋Š” ๋ฌธ์ž์—ด์ด ํฌํ•จ๋˜์ง€ ์•Š๋„๋ก ํ•ด์•ผ ํ•œ๋‹ค.
- `withExpireSeconds(int expireSeconds)`
- ์บ์‹œ ์•„์ดํ…œ์˜ Expire Time์„ Seconds ๋‹จ์œ„๋กœ ์ง€์ •ํ•œ๋‹ค.
- ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ 0์œผ๋กœ ์„ค์ •๋œ๋‹ค.
- ์ด ๋ฉ”์„œ๋“œ๋กœ expireSeconds๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ 0์œผ๋กœ ์„ค์ •๋œ๋‹ค.
- ์ธ์ž๋กœ ์–‘์ˆ˜, 0, -1์„ ์ œ์™ธํ•œ ๊ฐ’์€ ๋„ฃ์„ ์ˆ˜ ์—†๋‹ค.
- [1์žฅ์˜ Expiration Time ์„ค๋ช…](01-arcus-cache-basics.md#expiration-eviction)์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ง€์ •ํ•ด์•ผ ํ•œ๋‹ค.
- `long timeoutMilliSeconds`
- `withTimeoutMilliSeconds(long timeoutMilliSeconds)`
- ARCUS Client์˜ ๋น„๋™๊ธฐ ์—ฐ์‚ฐ์—์„œ ์‚ฌ์šฉํ•  Timeout์„ Milliseconds ๋‹จ์œ„๋กœ ์„ค์ •ํ•œ๋‹ค.
- ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ 700ms๋กœ ์ •ํ•ด์ง„๋‹ค.
- ๊ฐ’์„ ์ง€์ •ํ•˜๋Š” ๊ฒฝ์šฐ 0๋ณด๋‹ค ํฐ ๊ฐ’์„ ์ง€์ •ํ•ด์•ผ ํ•œ๋‹ค.
- ์ด ๋ฉ”์„œ๋“œ๋กœ timeoutMilliSeconds๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ 700ms๋กœ ์„ค์ •๋œ๋‹ค.
- ์ธ์ž๋กœ 0๋ณด๋‹ค ํฐ ๊ฐ’๋งŒ ๋„ฃ์„ ์ˆ˜ ์žˆ๋‹ค.
- `withOperationTranscoder(Transcoder<Object> operationTranscoder)`
- ARCUS Client์˜ ์—ฐ์‚ฐ ๊ฒฐ๊ณผ๋ฅผ Serialize, Deserializeํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” Transcoder ๊ฐ์ฒด๋ฅผ ์ง€์ •ํ•œ๋‹ค.
- ์ด ๋ฉ”์„œ๋“œ๋กœ operationTranscoder๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ Arcus Client์˜ ๊ธฐ๋ณธ Transcoder๊ฐ€ ์‚ฌ์šฉ๋œ๋‹ค.
- ์ธ์ž๋กœ null์„ ์ž…๋ ฅํ•  ์ˆ˜ ์—†๋‹ค.
- `enableGettingException()` / `disableGettingException()`
- ARCUS Client์˜ ์—ฐ์‚ฐ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์˜ˆ์™ธ๋ฅผ ๋ฐ›์„์ง€ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•œ๋‹ค.
- ๊ธฐ๋ณธ์ ์œผ๋กœ disable ์ƒํƒœ์ด๋ฉฐ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ์›๋ณธ ๋ฉ”์„œ๋“œ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋„๋ก ํ•œ๋‹ค.
- enable์‹œํ‚ฌ ๊ฒฝ์šฐ ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ๊ทธ๋Œ€๋กœ ๋ฐ˜ํ™˜ํ•˜๋ฏ€๋กœ ์ง์ ‘ ์ƒํ™ฉ์— ๋งž๊ฒŒ ์˜ˆ์™ธ๋ฅผ ์ฒ˜๋ฆฌํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค.
- `enableCachingNullValues()` / `disableCachingNullValues()`
- ์บ์‹œ ์•„์ดํ…œ์˜ ๊ฐ’์œผ๋กœ null์„ ํ—ˆ์šฉํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•œ๋‹ค.
- ๊ธฐ๋ณธ์ ์œผ๋กœ enable ์ƒํƒœ์ด๋ฉฐ null ๊ฐ’์„ NullValue ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์บ์‹œ์— ์ €์žฅํ•œ๋‹ค.
- disable ์‹œํ‚ฌ ๊ฒฝ์šฐ null ๊ฐ’์„ ์ €์žฅํ•˜๋ ค ํ•˜๋ฉด ์˜ˆ์™ธ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

### KeyGenerator

Expand Down Expand Up @@ -122,17 +134,18 @@ ARCUS Cache์˜ ์บ์‹œ ํ‚ค๋Š” ๊ณต๋ฐฑ(` `) ๋ฌธ์ž๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š๊ณ  ์ดˆ๊ธฐ์—

๋กœ์ปฌ ์บ์‹œ๋ฅผ ํ™œ์šฉํ•˜๋Š” Front Cache ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ, ๋กœ์ปฌ ์บ์‹œ ํŠน์„ฑ ์ƒ ๋ฐ์ดํ„ฐ์˜ ๋น„์ผ๊ด€์„ฑ์ด ์ƒ๊ธธ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ฃผ์˜ํ•ด์•ผ ํ•œ๋‹ค.

Front Cache ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ArcusCacheConfiguration ๊ฐ์ฒด์—์„œ ๋‹ค์Œ์˜ ์„ค์ •์„ ์ง€์ •ํ•˜๋ฉด ๋œ๋‹ค.
Front Cache ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ArcusCacheConfiguration ๊ฐ์ฒด์—์„œ ๋‹ค์Œ์˜ ๋ฉ”์„œ๋“œ๋“ค์„ ์‚ฌ์šฉํ•ด ์„ค์ •ํ•ด์•ผ ํ•œ๋‹ค.

- `ArcusFrontCache arcusFrontCache`
- `withArcusFrontCache(ArcusFrontCache arcusFrontCache)`
- ArcusFrontCache ๊ตฌํ˜„์ฒด๋ฅผ ์„ค์ •ํ•œ๋‹ค.
- ๊ธฐ๋ณธ ์ œ๊ณต๋˜๋Š” DefaultArcusFrontCache๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.
- null ๊ฐ’์„ ์„ค์ •ํ•˜๋ฉด Front Cache ๊ธฐ๋Šฅ์ด ๋น„ํ™œ์„ฑํ™”๋œ๋‹ค.
- `int frontExpireSeconds`
- ๊ธฐ๋ณธ์ ์œผ๋กœ ๋น„ํ™œ์„ฑํ™” ๋˜์–ด์žˆ๋Š” ์ƒํƒœ์ด๋ฉฐ, ์ธ์ž๋กœ null ๊ฐ’์€ ์ž…๋ ฅํ•  ์ˆ˜ ์—†๋‹ค.
- `withFrontExpireSeconds(int frontExpireSeconds)`
- Front Cache์˜ TTL(TimeToLive)์„ ์„ค์ •ํ•œ๋‹ค.
- `int forceFrontCaching`
- true: ARCUS Cache ์ €์žฅ์ด ์‹คํŒจํ•ด๋„ Front Cache์— ์ €์žฅํ•œ๋‹ค. ARCUS Cache์™€ ๋กœ์ปฌ ์บ์‹œ ๊ฐ„์˜ ๋ฐ์ดํ„ฐ ๋น„์ผ๊ด€์„ฑ์„ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, ์ž์ฃผ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์บ์‹ฑํ•  ๋•Œ ์ ํ•ฉํ•˜๋‹ค.
- false: ARCUS Cache ์ €์žฅ์ด ์‹คํŒจํ•˜๋ฉด Front Cache์—๋„ ์ €์žฅํ•˜์ง€ ์•Š๋Š”๋‹ค.
- `enableForcingFrontCache()`, `disableForcingFrontCache()`
- ARCUS ๋ณ€๊ฒฝ ์š”์ฒญ(put, delete, clear)์˜ ์„ฑ๊ณต, ์‹คํŒจ์— ์ƒ๊ด€ ์—†์ด Front Cache๋ฅผ ์ˆ˜ํ–‰ํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์—ฌ๋ถ€๋ฅผ ์„ค์ •ํ•œ๋‹ค.
- ๋ฐ์ดํ„ฐ ์ผ๊ด€์„ฑ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ์‰ฌ์šฐ๋ฏ€๋กœ ์ž์ฃผ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š๋Š” ๋ฐ์ดํ„ฐ์—๋งŒ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.
- ๊ธฐ๋ณธ์ ์œผ๋กœ disable ์ƒํƒœ์ด๋‹ค.

Front Cache๋ฅผ ์„ค์ •ํ•ด๋„, ํ•ญ์ƒ Front Cache์— ์ €์žฅํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. `forceFrontCaching` ์—ฌ๋ถ€์— ๋”ฐ๋ผ ๋‹ค์Œ๊ณผ ๊ฐ™์ด Front Cache์— ์ €์žฅํ•œ๋‹ค.

Expand Down
64 changes: 30 additions & 34 deletions docs/03-arcus-spring-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,20 @@ public class ArcusConfiguration extends CachingConfigurerSupport {

@Bean
public ArcusCacheConfiguration testCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("TEST-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(60);
cacheConfig.setTimeoutMilliSeconds(800);
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("TEST-")
.withPrefix("PRODUCT")
.withExpireSeconds(60)
.withTimeoutMilliSeconds(800);
}

@Bean
public ArcusCacheConfiguration devCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("DEV-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(120);
cacheConfig.setTimeoutMilliSeconds(800);
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("DEV-")
.withPrefix("PRODUCT")
.withExpireSeconds(120)
.withTimeoutMilliSeconds(800);
}
}
```
Expand Down Expand Up @@ -237,32 +235,30 @@ Front Cache ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์„ค๋ช…์€ [2์žฅ](02-arcus-spring-concept.md#front-c
```java
@Bean
public ArcusCacheConfiguration testCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("TEST-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(60);
cacheConfig.setTimeoutMilliSeconds(800);
/* front cache configuration */
cacheConfig.setArcusFrontCache(testArcusFrontCache());
cacheConfig.setFrontExpireSeconds(120);
cacheConfig.setForceFrontCaching(false);
/* front cache configuration */
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("TEST-")
.withPrefix("PRODUCT")
.withExpireSeconds(60)
.withTimeoutMilliSeconds(800)
/* front cache configuration */
.withArcusFrontCache(testArcusFrontCache())
.withFrontExpireSeconds(120)
.enableForcingFrontCache();
/* front cache configuration */
}

@Bean
public ArcusCacheConfiguration devCacheConfig() {
ArcusCacheConfiguration cacheConfig = new ArcusCacheConfiguration();
cacheConfig.setServiceId("DEV-");
cacheConfig.setPrefix("PRODUCT");
cacheConfig.setExpireSeconds(120);
cacheConfig.setTimeoutMilliSeconds(800);
/* front cache configuration */
cacheConfig.setArcusFrontCache(devArcusFrontCache());
cacheConfig.setFrontExpireSeconds(240);
cacheConfig.setForceFrontCaching(true);
/* front cache configuration */
return cacheConfig;
return new ArcusCacheConfiguration()
.withServiceId("DEV-")
.withPrefix("PRODUCT")
.withExpireSeconds(120)
.withTimeoutMilliSeconds(800)
/* front cache configuration */
.withArcusFrontCache(devArcusFrontCache())
.withFrontExpireSeconds(240)
.enableForcingFrontCache();
/* front cache configuration */
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"})
public class ArcusCache extends AbstractValueAdaptingCache {

public static final long DEFAULT_TIMEOUT_MILLISECONDS = 700L;
@Deprecated
public static final boolean DEFAULT_WANT_TO_GET_EXCEPTION = false;
public static final boolean DEFAULT_ALLOW_NULL_VALUES = true;

private final Logger logger = LoggerFactory.getLogger(this.getClass());

private String name;
Expand All @@ -97,7 +92,7 @@ public class ArcusCache extends AbstractValueAdaptingCache {
*/
@Deprecated
public ArcusCache() {
super(DEFAULT_ALLOW_NULL_VALUES);
super(ArcusCacheConfiguration.DEFAULT_ALLOW_NULL_VALUES);
this.configuration = new ArcusCacheConfiguration();
}

Expand Down
Loading