Baseflow / Baseflow/flutter_cache_manager

Respect must-revalidate cache-control header

未关闭
#275 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
type: enhancement
主要语言
Dart
星标
809
派生
510
平均合并
6 分钟
30 天内合并 PR
1

描述

I've been using flutter_cache_manager within my application and, in general, it's been a life saver for me. So please allow me to start by thanking the team for working on this plugin!

That said, I've been troubleshooting some unexpected behavior in my application, and I think I've tracked it down to this line within getSingleFile():

https://github.com/Baseflow/flutter_cache_manager/blob/7ef4334c84bca6d4ab869e7bae7eddf6402a42f0/flutter_cache_manager/lib/src/cache_manager.dart#L86

If I'm reading this correctly, getSingleFile() will prefer to return a file from the cache _even if that file has expired_ per the test on line 83. Is that correct behavior? In my API server, I am returning `Cache-Control: max-age=900` with the expectation that user agents will never display content which has expired without re-fetching it first.

Is this a bug or is this expected behavior?

It doesn't look like flutter_cache_manager respects `must-revalidate` either, so do you have a recommendation on how I could accomplish the behavior I'm looking for?

Thanks again!

贡献指南

打开贡献指南

调研方向

检查 lib/src/cache_manager.dart 第 83-86 行附近的代码,并追踪响应缓存头如何影响已过期的缓存文件。确认对 max-age 和 must-revalidate 的预期处理方式,然后使用相关的 cache-manager 测试验证最终行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
dart, flutter
领域
mobile
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。