更改“缓存控制” Couchdb 中视图的 HTTP 标头

发布于 2024-10-08 00:11:26 字数 169 浏览 0 评论 0原文

我正在将 CouchDB 用于 Web 应用程序,并且在 IE8 缓存视图结果时遇到问题。根据我的阅读,似乎一种解决方案是将“Cache-Control”HTTP 标头更改为“no-cache”。现在,CouchDB 返回值“must-revalidate”。

有没有办法改变这个标头的值?可以只改变视图吗?

I am using CouchDB for a web app and having problems with IE8 caching the results of a view. From my reading it seems one solution would be to change the "Cache-Control" HTTP header to "no-cache". Right now the CouchDB returns the value "must-revalidate".

Is there a way to change the value of this header at all? Can it just be changed for the view?

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

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

发布评论

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

评论(2

白日梦 2024-10-15 00:11:26

仅供参考,如果您使用 jQuery,请记住在 $.ajax() 调用中包含 cache:false 作为选项之一。

FYI if you are using jQuery just remember to include cache:false as one of your options in your $.ajax() calls.

梦归所梦 2024-10-15 00:11:26

CouchDB 应该使用 Etag,只要视图内容或代码发生变化,Etag 就会发生变化。然而,查看 CouchDB 的错误数据库,似乎存在 Internet Explorer 缓存问题 这个问题已经有一段时间没有解决了。如果这看起来像您遇到的问题,那么在错误单中提出修复方案或至少提醒 CouchDB 邮件列表/IRC 该问题可能会有所帮助。

看起来这个问题只是 IE 的错误,因此可能需要某种解决方法,例如使用古老的额外随机参数 hack 查询视图,以便在您知道否则会遇到缓存问题时使 URL 唯一。

CouchDB should be using Etags that change whenever the view content or code changes. However, looking through CouchDB's bug database it looks like there is a cache issue with Internet Explorer that's been unsolved for a while. If that looks like the problem you're having, it might be helpful to propose a fix in the bug ticket or at least remind the CouchDB mailinglist/IRC of the issue.

It looks like the issue is simply IE's bug though, so some sort of workaround might be necessary, like querying the view with the age old extra random parameter hack to make the URL unique when you know you would otherwise encounter a cache issue.

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