Skip to content

Conversation

@HynoR
Copy link
Contributor

@HynoR HynoR commented Dec 1, 2025

What this PR does / why we need it?

Cache-Control 设置会让图片用缓存不变不更改策略
而Last-Modified设置的值又会在下次请求重新拉取
导致这两个字段冲突,只做到了看似有用的缓存效果。
复现方法:

  1. 进入应用商店,访问第一页,然后切换到第二页。
  2. 切换其他卡片,等待若干分钟
  3. 再切回应用商店,第一页的图标仍然会请求而不是读缓存

Summary of your change

换成 etag 方案
一天内在缓存内读取,并保存 etag,一天过期后,请求后端会比对 etag,如果图片没变直接返回 304状态码,不返回内容让浏览器用缓存内容,减少网络传输的时间,同时保证版本更新。
效果:
接口返回的头:
image

过期后请求 :
image

后端响应速度:
image

86400 一天缓存的值可以视情况改动,一般来说app 的 icon 很难变

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 1, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 1, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ssongliu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant