Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2cdfa2803a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 연관된 이슈
📝 작업 내용
📌 요약
ETag,Last-Modified, 빈304 Not Modified를 사용하는 opt-in memory cache 재검증 경로 추가.memory(ttl:)동작과 cache·진행 중 동일 요청 병합 계약 유지NXAPIClient인스턴스별 cache 생명주기와 값 복사 공유 규칙 문서화🔍 상세
NXCache.revalidatingMemory(ttl:)추가GET만 대상200응답에ETag또는Last-Modified가 있을 때만 조건부 요청 수행.memory(ttl:), validator 없는200,201·204등200외 성공 응답은 기존 TTL 만료 뒤 무조건 요청 경로 유지If-None-Match,If-Modified-Since추가 전에 생성해 기존 key 계약 유지304수신 시 cached body와 갱신 헤더를 결합한200반환ETag와Last-Modified가 함께 있으면ETag우선304는 stale response 폐기 후 기존 응답 검증 경로 진행NXResponseCacheStoreactor가 만료 응답의 validator와 재검증 Task를 보관해, 동일 staleGET다섯 건의 transport 요청을 한 건으로 병합NXAPIClient(configuration:)마다 독립 cache·진행 중 요청 store 생성switch재컴파일 영향 안내 추가검증
swift build성공swift test성공 — 98개 테스트, 22개 suiteswiftlint lint --strict Sources Tests— 위반 0건git diff --check성공📸 영상 / 이미지 (Optional)
flowchart LR request["private·비인증·본문 없는 GET"] --> key["NXRequestCacheKey<br/>조건부 header 추가 이전"] key --> store["NXResponseCacheStore<br/>cache · 진행 중 요청"] store --> ttl{"TTL 유효?"} ttl -->|예| cached["cached response"] cached --> pipeline["NXResponsePipeline"] ttl -->|기존: 만료된 모든 응답| reload["무조건 GET"] ttl -->|현재 .revalidatingMemory: 만료| eligible{"cached 200과<br/>ETag 또는 Last-Modified?"} eligible -->|아니오| reload eligible -->|예| conditional["If-None-Match<br/>If-Modified-Since"] conditional --> transport["NXHTTPTransport"] reload --> transport transport --> response{"응답"} response -->|200| replace["body·validator cache 갱신"] replace --> pipeline response -->|일치하는 빈 304| merged["cached body·갱신 header 결합<br/>200 응답"] merged --> pipeline response -->|불일치 또는 본문 304| discard["stale response 폐기"] discard --> pipeline linkStyle 5 stroke:#6b7280,stroke-width:2px,stroke-dasharray:8 5;점선은 기존의 'TTL 만료 응답 전체를 무조건 요청'으로 연결하던 경로이며, 현재는 validator가 있는 cached
200에서만 조건부 요청 연결선으로 대체된 부분입니다.