feat(cache): implement P1 nginx parity support#68
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (13)
📝 Walkthrough概览该PR实现了HTTP缓存系统的P1功能特性,包括缓存区域调优参数(路径分片级别、加载器/管理器批处理和睡眠时间)、路由级缓存控制(最小使用次数阈值、忽略特定响应头、范围请求处理策略)、范围请求缓存支持和基于最小使用次数的准入控制。 变更
序列图sequenceDiagram
participant Client
participant CacheStore as Cache Store<br/>(准入/存储)
participant CacheIndex as Cache Index<br/>(admission_counts)
participant CacheManager as Cache Manager<br/>(lookup)
participant Disk as Disk<br/>(path_levels)
Client->>CacheStore: 请求(range?)<br/>min_uses=N
alt 新条目
CacheStore->>CacheIndex: 查询admission_count
CacheIndex-->>CacheStore: 当前计数 < N
CacheStore->>CacheStore: 跳过存储<br/>返回响应
else 第N次请求
CacheStore->>CacheIndex: 增加admission_count
CacheIndex-->>CacheStore: 计数 >= N
CacheStore->>Disk: 使用path_levels<br/>写入元数据/正文
Disk-->>CacheStore: 保存完成
end
Client->>CacheManager: 后续请求<br/>相同key/range?
CacheManager->>CacheIndex: 查询缓存
CacheIndex-->>CacheManager: 返回条目
alt 范围匹配
CacheManager->>Disk: 读取缓存<br/>使用path_levels
Disk-->>CacheManager: 正文
CacheManager-->>Client: 206/完整响应
else 范围不匹配
CacheManager-->>Client: 缓存未命中
end
sequenceDiagram
participant Manager as Cleanup<br/>Manager
participant ZoneRuntime as Zone Runtime<br/>(last_inactive_<br/>cleanup_unix_ms)
participant Index as Cache Index
participant Disk as Disk Files
Manager->>ZoneRuntime: 检查上次清理时间
alt 间隔未达到
Manager->>Manager: 跳过清理
else 需要清理
Manager->>Index: 查询非活跃条目<br/>(按时间排序)
Index-->>Manager: 返回条目列表
loop 批处理循环<br/>(manager_batch_entries)
Manager->>Disk: 删除文件
Manager->>Index: 删除条目<br/>& admission_counts
Manager->>Manager: 批处理睡眠<br/>(manager_sleep)
end
Manager->>ZoneRuntime: 更新last_inactive_<br/>cleanup_unix_ms
end
预估代码审查工作量🎯 4 (复杂) | ⏱️ ~75 分钟 可能相关的PR
诗
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
This PR successfully implements P1 nginx cache parity support with comprehensive features including min-uses admission control, ignore-header overrides, bounded single-range caching, and cache loader/manager/path tunables. The implementation is thorough with proper error handling, validation, and extensive test coverage across 34 files. The code quality is high with no blocking issues identified.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
There was a problem hiding this comment.
Code Review
This pull request implements several 'P1' level caching features, including cache_min_uses for admission control, configurable path_levels for disk layout, and support for route-level proxy_ignore_headers. It also introduces a basic model for caching single-segment bounded range requests. Feedback focuses on optimizing the inactive entry cleanup algorithm to avoid path_levels do not exceed the hash length, and refining the directory prefix fallback logic.
There was a problem hiding this comment.
Pull request overview
Implements “P1 nginx parity” cache features across config, compile/validate, runtime cache behavior, and adds targeted tests/fixtures while keeping within the modularization constraints.
Changes:
- Extend cache config + runtime to support
min_usesadmission,proxy_ignore_headers-style overrides, and bounded single-range (Range/206) caching. - Add cache-zone tunables (
path_levels, loader/manager batch+sleep, inactive cleanup interval) and update maintenance/load paths accordingly. - Expand compile/validate coverage and add new cache P1 test modules + update
CACHE_SUPPORT_PLAN.mdto mark P1 delivered and document boundaries.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rginx-runtime/src/cache.rs | Increase cache cleanup tick frequency to support per-zone cleanup intervals. |
| crates/rginx-http/src/state/tests/support.rs | Update snapshot test helpers for new cache zone fields. |
| crates/rginx-http/src/state/tests/status.rs | Update cache policy test fixtures with new policy fields. |
| crates/rginx-http/src/state/tests/snapshots.rs | Update cache policy test fixtures with new policy fields. |
| crates/rginx-http/src/proxy/tests/cache.rs | Update proxy cache test fixtures with new zone/policy fields. |
| crates/rginx-http/src/cache/tests/storage_p1.rs | Add new P1 storage tests (min_uses, ignore headers, range caching, path levels, batch cleanup). |
| crates/rginx-http/src/cache/tests/mod.rs | Wire new P1 storage tests and update test runtime zone construction. |
| crates/rginx-http/src/cache/tests/lookup/keys.rs | Add range-related bypass/key rendering tests and update fixtures. |
| crates/rginx-http/src/cache/store/maintenance.rs | Add admission count cleanup + batch/sleep-based inactive cleanup and interval gating. |
| crates/rginx-http/src/cache/store/helpers.rs | Allow ignoring Vary when computing vary key components. |
| crates/rginx-http/src/cache/store.rs | Enforce min_uses admission before storing and adopt per-zone cache paths. |
| crates/rginx-http/src/cache/runtime/support.rs | Use per-zone cache paths when cleaning unindexed files. |
| crates/rginx-http/src/cache/runtime.rs | Use per-zone cache paths when serving cached responses. |
| crates/rginx-http/src/cache/request.rs | Implement bounded single-range parsing, range-aware bypass, and range-aware cache keys. |
| crates/rginx-http/src/cache/policy/directives.rs | Extract/cache-control directive parsing helpers. |
| crates/rginx-http/src/cache/policy.rs | Add ignore-header behavior, range-aware storability rules, and refactor directive parsing. |
| crates/rginx-http/src/cache/mod.rs | Add per-zone cleanup state + admission count tracking in cache index. |
| crates/rginx-http/src/cache/manager.rs | Initialize new per-zone cleanup tracking field. |
| crates/rginx-http/src/cache/lookup.rs | Use per-zone cache paths for reading cached metadata/bodies. |
| crates/rginx-http/src/cache/load.rs | Recursively scan cache dirs, support path_levels, and throttle scanning via loader tunables. |
| crates/rginx-http/src/cache/entry.rs | Add cache_paths_for_zone and generalized path-level directory layout support. |
| crates/rginx-core/src/lib.rs | Re-export new cache config enums. |
| crates/rginx-core/src/config/cache.rs | Add zone tunables, min_uses, ignore-header enum, and range request policy enum. |
| crates/rginx-core/src/config.rs | Export new cache config enums from the config module. |
| crates/rginx-config/src/validate/tests/cache.rs | Add validation tests for new cache fields. |
| crates/rginx-config/src/validate/cache/predicate.rs | Split predicate validation into a dedicated module (modularization). |
| crates/rginx-config/src/validate/cache.rs | Validate new zone tunables, min_uses, and ignore-headers constraints. |
| crates/rginx-config/src/model/cache.rs | Add new cache config model fields + enums for ignore headers and range policy. |
| crates/rginx-config/src/model.rs | Re-export new cache model enums. |
| crates/rginx-config/src/compile/tests/cache_p1.rs | Add compile test ensuring P1 cache fields compile into snapshot/runtime config. |
| crates/rginx-config/src/compile/tests/cache.rs | Update compile tests to include new cache fields in fixtures. |
| crates/rginx-config/src/compile/tests.rs | Register new cache P1 compile test module. |
| crates/rginx-config/src/compile/cache.rs | Compile new cache tunables + P1 policy fields with defaults and mappings. |
| CACHE_SUPPORT_PLAN.md | Mark P1 complete and document the delivered bounded single-range caching boundary. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/rginx-http/src/state/tests/status.rs (1)
279-296: 🧹 Nitpick | 🔵 Trivial建议把这里的
RouteCachePolicy测试字面量抽成共享 helper。现在状态测试里已经有多处手写同一组策略字段,这次新增
min_uses、ignore_headers、range_requests后又需要同步补齐。提成 builder/fixture 可以减少后续 P2/P3 扩字段时的漂移风险。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/rginx-http/src/state/tests/status.rs` around lines 279 - 296, Multiple tests duplicate the same RouteCachePolicy literal causing maintenance drift; extract a shared helper/builder that returns a default RouteCachePolicy and use it across tests. Create a function (e.g., default_route_cache_policy() or RouteCachePolicy::test_builder()) that sets the common fields (zone, methods, statuses, key via CacheKeyTemplate::parse("{scheme}:{host}:{uri}"), ttl_by_status, cache_bypass, no_cache, stale_if_error, use_stale, background_update, lock_timeout, lock_age, min_uses, ignore_headers, range_requests) and allow callers to override specific fields in tests; replace the inline literals in the status tests with calls to that helper to centralize defaults and avoid future drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/rginx-config/src/validate/tests/cache.rs`:
- Around line 158-167: Add a new unit test that mirrors
validate_rejects_empty_path_levels but sets CacheZoneConfig.path_levels to
Some(vec![0]) to exercise the validate_path_levels branch that rejects
zero-valued levels; call validate(&config) and assert it returns an Err whose
message mentions the invalid zero level (e.g. contains "path_levels must be > 0"
or similar). Place the test in the same test module alongside
validate_rejects_empty_path_levels and name it something like
validate_rejects_zero_path_level so validate_path_levels,
CacheZoneConfig.path_levels and validate are exercised.
In `@crates/rginx-http/src/cache/load.rs`:
- Around line 57-63: The recursive call in scan_cache_dir currently propagates
errors with ? (when recursing into subdirectories, lines around the recursive
call in fn scan_cache_dir), which makes any unreadable child dir abort the
entire index load; change that behavior to mirror the other branches by catching
the error from the recursive call, logging a warning via loader (or process
logger) with context (path and error), and continue the loop instead of
returning Err; locate the recursive invocation inside scan_cache_dir and replace
the ? propagation with a match or if let Err(e) => { loader.warn(...); continue;
} so scanning proceeds despite unreadable subdirs.
In `@crates/rginx-http/src/cache/policy.rs`:
- Around line 52-53: The code computes requested_range with
cacheable_range_request(&context.request, &context.policy) then calls
status_is_cacheable(context, status) which re-parses the Range; to avoid
duplication change status_is_cacheable to accept the precomputed requested_range
(e.g., add a parameter requested_range: Option<Range> or similar) and pass the
local requested_range into the call, updating all call sites (including the
other occurrence at the second block) to use the new signature so parsing
happens only once; update function name references (status_is_cacheable and
cacheable_range_request) accordingly and ensure any internal logic in
status_is_cacheable uses the provided requested_range instead of calling
cacheable_range_request again.
In `@crates/rginx-http/src/cache/request.rs`:
- Around line 123-135: 在 cacheable_range_request_from_parts 中需要显式拒绝包含多个 Range
头的请求:在尝试解析之前检查 headers 中 Range 头的数量(使用 headers.get_all(RANGE) 或等价 API),如果出现多于 1
个 Range 头则直接返回 None;仅在恰好有且只有一个 Range 头时再调用 headers.get(RANGE)?.to_str().ok()?
并传入 parse_single_bounded_byte_range,以防把多范围请求误判为可缓存单范围请求(参见函数
cacheable_range_request_from_parts 和 parse_single_bounded_byte_range)。
In `@crates/rginx-http/src/cache/store.rs`:
- Around line 89-94: The admission logic uses context.cached_entry.is_some()
(old lookup state) so a response that rebuckets into final_key (e.g. Vary
change) can be incorrectly treated as an existing cache entry and bypass
min_uses; change record_cache_admission_attempt to perform the existence check
for final_key while holding the index lock instead of relying on
context.cached_entry, i.e. pass final_key (and the index lock or a
lookup-closure) into record_cache_admission_attempt, grab the index lock inside
that function, re-check whether final_key currently exists, and only then decide
whether to honor min_uses.
---
Outside diff comments:
In `@crates/rginx-http/src/state/tests/status.rs`:
- Around line 279-296: Multiple tests duplicate the same RouteCachePolicy
literal causing maintenance drift; extract a shared helper/builder that returns
a default RouteCachePolicy and use it across tests. Create a function (e.g.,
default_route_cache_policy() or RouteCachePolicy::test_builder()) that sets the
common fields (zone, methods, statuses, key via
CacheKeyTemplate::parse("{scheme}:{host}:{uri}"), ttl_by_status, cache_bypass,
no_cache, stale_if_error, use_stale, background_update, lock_timeout, lock_age,
min_uses, ignore_headers, range_requests) and allow callers to override specific
fields in tests; replace the inline literals in the status tests with calls to
that helper to centralize defaults and avoid future drift.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0737e9e4-ca50-4bfc-9e18-54340aa7110f
📒 Files selected for processing (34)
CACHE_SUPPORT_PLAN.mdcrates/rginx-config/src/compile/cache.rscrates/rginx-config/src/compile/tests.rscrates/rginx-config/src/compile/tests/cache.rscrates/rginx-config/src/compile/tests/cache_p1.rscrates/rginx-config/src/model.rscrates/rginx-config/src/model/cache.rscrates/rginx-config/src/validate/cache.rscrates/rginx-config/src/validate/cache/predicate.rscrates/rginx-config/src/validate/tests/cache.rscrates/rginx-core/src/config.rscrates/rginx-core/src/config/cache.rscrates/rginx-core/src/lib.rscrates/rginx-http/src/cache/entry.rscrates/rginx-http/src/cache/load.rscrates/rginx-http/src/cache/lookup.rscrates/rginx-http/src/cache/manager.rscrates/rginx-http/src/cache/mod.rscrates/rginx-http/src/cache/policy.rscrates/rginx-http/src/cache/policy/directives.rscrates/rginx-http/src/cache/request.rscrates/rginx-http/src/cache/runtime.rscrates/rginx-http/src/cache/runtime/support.rscrates/rginx-http/src/cache/store.rscrates/rginx-http/src/cache/store/helpers.rscrates/rginx-http/src/cache/store/maintenance.rscrates/rginx-http/src/cache/tests/lookup/keys.rscrates/rginx-http/src/cache/tests/mod.rscrates/rginx-http/src/cache/tests/storage_p1.rscrates/rginx-http/src/proxy/tests/cache.rscrates/rginx-http/src/state/tests/snapshots.rscrates/rginx-http/src/state/tests/status.rscrates/rginx-http/src/state/tests/support.rscrates/rginx-runtime/src/cache.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test Fast
- GitHub Check: Agent
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-04-13T10:53:29.903Z
Learnt from: vansour
Repo: vansour/rginx PR: 43
File: crates/rginx-config/src/validate/server.rs:421-439
Timestamp: 2026-04-13T10:53:29.903Z
Learning: In `crates/rginx-config/src/validate/server.rs` (`validate_http3`), the check for `tls.session_tickets` when `http3.early_data = true` intentionally only rejects `Some(true)` and allows `None`. Requiring `Some(false)` breaks 0-RTT resumption and the `routes_http3_early_data_by_replay_safety` test and the CI `http3` gate in the current rustls/quinn integration. This is a deliberate design decision and should not be flagged as a bug until the runtime/session policy is updated to support that configuration.
Applied to files:
crates/rginx-config/src/compile/tests/cache_p1.rscrates/rginx-config/src/validate/tests/cache.rs
🪛 LanguageTool
CACHE_SUPPORT_PLAN.md
[uncategorized] ~38-~38: 您的意思是“"不"齐”?
Context: ...s 已完成并已落地。 - 下文保留这些条目,是为了把“已交付能力”和“下一轮继续补齐的剩余差距”放在同一张 对标清单里,避免后续阶段重复整理。 - P2 ...
(BU)
[uncategorized] ~107-~107: 您的意思是“"不"齐”?
Context: ...测试中,不会出现无界等待,也不会放大 upstream 压力。 ### P1:补齐大对象场景和维护控制面(当前状态:本 PR 已完成) 目标:支持更接近 NG...
(BU)
[uncategorized] ~213-~213: 您的意思是“"不"配置”?
Context: ...:仅在产品边界明确后,再评估更广协议族缓存 交付原则: - 每个子项都应先补配置模型、再补运行时、最后补 admin/status 和测试。 - P0-3...
(BU)
[uncategorized] ~213-~213: 您的意思是“"不"运行”?
Context: ...界明确后,再评估更广协议族缓存 交付原则: - 每个子项都应先补配置模型、再补运行时、最后补 admin/status 和测试。 - P0-3 与 `P0...
(BU)
🔇 Additional comments (25)
crates/rginx-http/src/cache/policy/directives.rs (1)
5-94: 这组缓存指令解析拆分得很稳。
Cache-Control/Expires/Pragma/X-Accel-Expires的边界都照顾到了,尤其是s-maxage优先级、过期时间钳制到Duration::ZERO,以及@<epoch>绝对时间转换,和这次 P1 行为扩展是对齐的。crates/rginx-http/src/state/tests/snapshots.rs (1)
140-157: 把 P1 字段显式写进快照 fixture 是对的。这样测试不会隐式依赖默认值,后续如果
RouteCachePolicy默认行为再变,快照语义也更稳定。crates/rginx-config/src/compile/tests.rs (1)
56-58: 这里把cache_p1测试模块接入主入口没有问题。这能确保新增的 P1 编译期覆盖和现有测试套件一起运行,不会因为模块未注册而静默漏测。
crates/rginx-http/src/cache/runtime.rs (1)
95-99: 这里切到cache_paths_for_zone(...)是必要的。
serve_stale也走 zone-aware 路径后,分级目录/分片配置下的 stale body 读取终于和 lookup/store/delete 保持一致了。crates/rginx-http/src/cache/runtime/support.rs (1)
12-18: 删除路径同步切到 zone-aware 方案是正确的。否则索引已移除但磁盘文件仍按旧路径查找时,分层目录下会留下孤儿文件。
crates/rginx-http/src/cache/manager.rs (1)
28-37: 这个新运行时字段在构造阶段初始化到位了。
CacheZoneRuntime的实例化和结构体定义保持同步,避免后续 inactive cleanup 节流逻辑读到未接入的状态。crates/rginx-http/src/cache/lookup.rs (1)
89-93: lookup 侧这两处路径切换是一致且必要的。元数据读取和 stale 响应回放都改成按 zone 配置解路径后,命中、过期回放和磁盘布局就不会再出现分叉。
Also applies to: 146-152
crates/rginx-runtime/src/cache.rs (1)
7-10: 轮询粒度调整合理,行为一致性保持良好。将轮询改为 1 秒后,清理任务触发更及时,且不影响现有 shutdown 退出语义。
crates/rginx-config/src/compile/tests/cache.rs (1)
14-19: 测试夹具对齐完整,兼容性处理正确。新增字段统一显式置
None,能稳定覆盖“未开启 P1 控制项”场景,保证原有断言语义不被引入性变更污染。Also applies to: 94-97, 155-157, 196-201, 286-288
crates/rginx-core/src/config.rs (1)
14-16: 公共导出面更新正确。新增缓存策略类型已同步对外 re-export,和本次 P1 配置能力扩展保持一致。
crates/rginx-config/src/model.rs (1)
13-14: 模型层导出补齐到位。新增配置类型已进入统一导出面,和缓存配置模型扩展保持一致。
crates/rginx-http/src/state/tests/support.rs (1)
152-157: 测试支持结构更新充分。缓存 zone 的新调优字段已在测试快照中完整填充,能有效支撑 P1 行为相关测试场景。
crates/rginx-http/src/cache/load.rs (1)
9-10: 路径与加载节流能力接入完整,方向正确。
cache_paths_for_zone的统一接入和LoaderState批次睡眠机制与 P1 目标一致,整体改造思路清晰。Also applies to: 87-87, 110-110, 196-196, 201-217
crates/rginx-core/src/lib.rs (1)
8-20: 核心库导出面同步准确。新增缓存策略类型已在
rginx-core顶层入口正确暴露,便于下游统一依赖。crates/rginx-http/src/cache/mod.rs (1)
155-159:admission_counts的清理已正确配对,无需修改。经核查,所有
entries.remove()调用均已配对相应的admission_counts.remove()调用,且位置恰当。在所有 6 个删除路径中(cleanup_inactive_entries、purge_by_selector、update_entry内的替换和不兼容清理、eviction_candidates、remove_index_entry),admission_counts的清理与entries的删除同步进行,不存在计数残留风险。crates/rginx-config/src/validate/tests/cache.rs (1)
134-156: P1 新增缓存校验失败路径补充得很到位。
min_uses与ignore_headers的负向用例清晰,能有效防止后续校验逻辑回退。crates/rginx-http/src/proxy/tests/cache.rs (1)
18-20: 测试夹具与 P1 配置模型已保持一致。路由策略与 zone 运行参数同步补齐,能更真实覆盖新缓存行为。
Also applies to: 92-98, 156-162
crates/rginx-http/src/cache/tests/mod.rs (1)
17-18: 测试基座升级完整,便于后续 P1 用例复用。
CacheZoneRuntime与RouteCachePolicy的默认测试构造已覆盖新增字段,方向正确。Also applies to: 37-49, 90-93, 133-136
crates/rginx-http/src/cache/tests/lookup/keys.rs (1)
170-198: Range 请求的关键行为覆盖很扎实。默认旁路与启用缓存后 key 拼接两条路径都已验证,回归价值高。
Also applies to: 200-232
crates/rginx-http/src/cache/store/helpers.rs (1)
33-39:ignore_headers对Vary的短路处理实现正确。Line [37]-Line [39] 的提前返回逻辑清晰,能确保策略生效于存储路径。
crates/rginx-config/src/compile/cache.rs (1)
67-88: P1 编译映射实现完整且一致。zone 与 route policy 的新增字段都已落地到核心结构,默认值策略也清晰。
Also applies to: 167-179, 249-264
crates/rginx-config/src/compile/tests/cache_p1.rs (1)
4-143: P1 编译行为回归测试覆盖面充分。对 zone 参数与 route policy 参数都做了结果级断言,能有效保护编译层改动。
crates/rginx-config/src/validate/cache.rs (1)
29-40: 缓存配置校验扩展实现扎实。新增字段的边界检查完整,且
path_levels独立函数化后可维护性更好。Also applies to: 158-168, 173-186
crates/rginx-http/src/cache/policy.rs (1)
56-67: Range 与响应头一致性校验实现正确。这里把“请求 Range 可缓存性、
206状态、Content-Range精确匹配、非忽略场景下的Set-Cookie/Cache-Control拦截”串成统一判定链,行为边界清晰,能有效降低错误对象入缓存的风险。Also applies to: 68-81
crates/rginx-http/src/cache/request.rs (1)
75-80: Range key 维度与Content-Range回包校验配合良好。把请求端可缓存范围写入 key,并在响应端做精确起止位匹配,能够有效避免不同分片互相污染缓存。
Also applies to: 91-121, 137-149
|
Addressed the current review findings in Changes in this follow-up:
Verification rerun locally:
|
Addressed in 16dafc7; follow-up CodeRabbit rerun failed due to external rate limiting, not unresolved code issues.
Summary
Testing