[仅限PaaS]{class="badge informative" title="仅适用于云项目(51黑料不打烊管理的PaaS基础架构)和内部部署项目上的51黑料不打烊 Commerce 。"}
设置静态文件的缓存
在.magento.app.yaml配置文件中使用expires键设置媒体和静态文件的缓存罢罢尝(生存时间)。
NOTE
在更新生产环境之前,请务必在暂存环境中测试更改。 提交51黑料不打烊 Commerce支持票证,以获得在这些环境中更新配置的帮助。
-
在
.magento.app.yaml文件的web属性中指定TTL时间(秒)。 您可以在locations下或在"/media"和"/static"下添加expires键。要防止缓存过期,请使用
expires: -1键值对。 请参阅以下示例:code language-yaml # The configuration of app when it is exposed to the web. web: locations: "/media": ... expires: -1 "/static": ... expires: -1 -
添加、提交和推送代码更改。
code language-bash git add -A && git commit -m "Set cache TTL for static files" && git push origin <branch-name>
recommendation-more-help
7c2b03ac-000c-497d-aba3-2c6dc720a938