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

Conversation

oliviarla
Copy link
Collaborator

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

  • ArcusCacheConfiguration์œผ๋กœ ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ’์„ ์„ค์ •ํ•  ๋•Œ setter ๋Œ€์‹  withServiceId, enableFrontCaching ๋“ฑ์˜ ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๋ณ€๊ฒฝํ•˜๊ณ  ํ•ด๋‹น ๋ฉ”์„œ๋“œ ์•ˆ์—์„œ ์ž…๋ ฅ๊ฐ’์„ ๊ฒ€์ฆํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž ์ž…์žฅ์—์„œ ์ฝ”๋“œ๊ฐ€ ์ข€ ๋” ๊ฐ„๊ฒฐํ•ด์ง„๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์œผ๋ฉฐ, Redis์™€ Couchbase์™€ ๋น„์Šทํ•œ ๋ฐฉ์‹์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • setter๋ฅผ deprecate์‹œํ‚ค๊ธฐ ๋•Œ๋ฌธ์—, ๋‚˜์ค‘์— setter๊ฐ€ ์ œ๊ฑฐ๋˜๋ฉด xml์œผ๋กœ ArcusCacheConfiguration์˜ ๊ฐ ํ•„๋“œ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์—†๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๋ฐ˜๋“œ์‹œ xml ๋นˆ ๋“ฑ๋ก ๋ฐฉ์‹์„ ์ง€์›ํ•ด์•ผ ํ•œ๋‹ค๋ฉด ArcusCacheConfigurationFactoryBean ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค๊ณ  ์ด ์•ˆ์— setter๋ฅผ ๋‘๋ฉด xml๊ธฐ๋ฐ˜ ์„ค์ • ๋ฐฉ์‹์„ ์ง€์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜๊ฒฌ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.
  • ๊ธฐ์กด ArcusCache์— ์žˆ๋˜ ๊ธฐ๋ณธ๊ฐ’๋“ค์„ ArcusCacheConfiguration์—์„œ ๋” ๋งŽ์ด ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ์˜ฎ๊ฒผ์Šต๋‹ˆ๋‹ค.

@oliviarla oliviarla self-assigned this Sep 10, 2024
Copy link
Contributor

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

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

์ผ๋ถ€ ๋ฆฌ๋ทฐ

README.md Outdated
defaultCacheConfig.setExpireSeconds(60);
defaultCacheConfig.setTimeoutMilliSeconds(800);
return defaultCacheConfig;
return ArcusCacheConfiguration.defaultConfig()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@brido4125 @uhm0311
๊ธฐ์กด ๋ฐฉ์‹์—์„œ ํ˜„์žฌ ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ๊ดœ์ฐฎ์€์ง€ ์˜๊ฒฌ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

Copy link
Collaborator

Choose a reason for hiding this comment

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

์ €๋Š” ์ข‹๋‹ค๊ณ  ์ƒ๊ฐ๋˜์–ด์„œ ๋ฆฌ๋ทฐ ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

import org.springframework.util.Assert;

@SuppressWarnings("DeprecatedIsStillUsed")
public class ArcusCacheConfiguration implements InitializingBean {
Copy link
Collaborator

Choose a reason for hiding this comment

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

๊ธฐ์กด ์‚ฌ์šฉ์ž๊ฐ€ ArcusCacheConfiguration์„ InitializingBean ํƒ€์ž…์œผ๋กœ ์‚ฌ์šฉํ•œ ๋กœ์ง์€
๊ฑฐ์˜ ์—†๊ฒ ์ง€๋งŒ ํƒ€์ž…์ด ๋ณ€๊ฒฝ๋˜๋Š” ๊ฑฐ๋‹ˆ ๋ฆด๋ฆฌ์ฆˆ ํ•  ๋•Œ ๋ณ„๋„์˜ ์•Œ๋ฆผ์€ ํ•„์š”ํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

@oliviarla oliviarla force-pushed the refactor branch 2 times, most recently from 9601b53 to 2f17f09 Compare September 10, 2024 07:50
@jhpark816
Copy link
Contributor

@oliviarla

์•„๋ž˜ ์ฝ”๋“œ์— ์žˆ๋Š” config ๊ฐ์ฒด ์ƒ์„ฑ ๋ฐฉ์‹๋„ ์ฐธ๊ณ  ๋ฐ”๋ž๋‹ˆ๋‹ค.

  public LocalCacheManager(String name, int max, int exptime, boolean copyOnRead,
                           boolean copyOnWrite) {
    this.cache = CacheManager.getInstance().getCache(name);
    if (cache == null) {
      CacheConfiguration config =
              new CacheConfiguration(name, max)
                      .copyOnRead(copyOnRead)
                      .copyOnWrite(copyOnWrite)
                      .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU)
                      .eternal(false)
                      .timeToLiveSeconds(exptime)
                      .timeToIdleSeconds(exptime)
                      .diskExpiryThreadIntervalSeconds(60)
                      .persistence(new PersistenceConfiguration().strategy(
                          PersistenceConfiguration.Strategy.NONE));
      this.cache = new Cache(config, null, null);
      CacheManager.getInstance().addCache(cache);

      logger.info("Arcus k/v local cache is enabled : %s", cache.toString());
    }
  }

Copy link
Contributor

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

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

๋ฆฌ๋ทฐ ์™„๋ฃŒ

README.md Outdated Show resolved Hide resolved
@oliviarla oliviarla force-pushed the refactor branch 3 times, most recently from 1ec3aad to 8ceb3c6 Compare September 11, 2024 07:16
Copy link
Contributor

@jhpark816 jhpark816 left a comment

Choose a reason for hiding this comment

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

๋ฆฌ๋ทฐ ์™„๋ฃŒ

README.md Outdated
- `withFrontExpireSeconds(int frontExpireSeconds)`
- Set Front Cache TTL(TimeToLive).
- `enableForcingFrontCache()`, `disableForcingFrontCache()`
- Set whether to perform Front Cache regardless of success or failure of ARCUS request.
Copy link
Contributor

@jhpark816 jhpark816 Sep 11, 2024

Choose a reason for hiding this comment

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

์กฐํšŒ ์š”์ฒญ์ด ์•„๋‹Œ set, .... ๋“ฑ์˜ ๋ณ€๊ฒฝ ์š”์ฒญ์— ๋Œ€ํ•œ ์„ค์ •์ด๋ฉฐ,
๋ณ€๊ฒฝ ์š”์ฒญ์ด ์‹คํŒจํ•˜๋”๋ผ๋„ Front cache์— set, ... ๋“ฑ์œผ๋กœ ์ €์žฅํ•ด ๋‘˜ ๊ฒƒ์ธ์ง€๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ด๋Ÿฌํ•œ ๋‚ด์šฉ์ด ๋ช…ํ™•ํ•˜๊ฒŒ ๋“œ๋Ÿฌ๋‚˜๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

@jhpark816 jhpark816 merged commit 5770901 into naver:develop Sep 11, 2024
3 checks passed
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.

3 participants