在开发环境中缓存?

发布于 2024-12-27 19:26:45 字数 1432 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉鱼一梦 2025-01-03 19:26:45

我想我不同意。

希望您的客户端代码缓存在 dev 中。否则,您将花费大量时间清除缓存,并且您将花费大量时间找出为什么事情不起作用,结果只是“哎呀,我没有清除缓存”问题。

确实希望为您的版本缓存它。这可以通过构建过程中的配置轻松完成——您可以将一些特定于构建的信息附加到构建工件的文件名中,浏览器将为您缓存内容。当新版本发布时,相关文件的名称会有所不同,因此浏览器将搜索它们。

I think I disagree.

You don't want your client side code cached in dev. Else you are going to spend a lot of time clearing caches, and you are going to spend a lot of time figuring out why things don't work, only for it to be a "oops, I didn't clear my cache" issue.

You do want it cached for your releases. This is easily accomplished via configuration in your build process -- you can append some build specific info to the file names of your build artifacts, and the browser will cache the content for your. When a new release comes, the names of the relevant files are different so the browser will search for them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文