feat: Implement ETag support for app icon caching in GetAppIcon API#11136
feat: Implement ETag support for app icon caching in GetAppIcon API#11136HynoR wants to merge 1 commit into1Panel-dev:dev-v2from
Conversation
|
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. DetailsInstructions 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What this PR does / why we need it?
Cache-Control 设置会让图片用缓存不变不更改策略
而Last-Modified设置的值又会在下次请求重新拉取
导致这两个字段冲突,只做到了看似有用的缓存效果。
复现方法:
Summary of your change
换成 etag 方案

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

后端响应速度:

86400 一天缓存的值可以视情况改动,一般来说app 的 icon 很难变
Please indicate you've done the following: