管理 ajax Couchdb 调用和 IE (hta) 主动缓存

发布于 2024-08-03 10:13:32 字数 635 浏览 6 评论 0原文

我遇到了一个非常烦人的问题,并想出了一个非常丑陋的黑客来让它工作。

我使用 CouchDB 数据库(供公司内部使用)开发 Hta 应用程序。问题是数据库查询似乎有一些非常激进的缓存,并且很难想出解决方案。 因此,数据库中更新的数据不会出现在浏览器中,浏览器的缓存中仍然有先前的请求结果,直到整个应用程序重新启动。

哦,CouchDB(或者它的 mochiweb 服务器)不允许未知的 GET 变量,因此附加某种时间戳的通常解决方案不起作用。

我找到了某种解决方案,但它太丑陋了。解决方案是:

  • 只打开具有最新版本号的文档(简单又漂亮,不适用于视图)
  • 使用 apache 作为转发代理,监听 200 多个端口,并在每次读取查询时随机选择一个。 (那是丑陋的)。

Hta 接受对其他端口的 ajax 调用(甚至可能在其他域上,奇怪的行为),所以它工作得很好,我只有 1/200 的机会新数据不会出现,但这仍然比 1/1 更好,我可以接受。

所以我想问的是,有没有更好的解决方案?我可以侵入 mochiweb 服务器来修改缓存标头(并希望它们不会被忽略)吗?是否有一个特殊的未知“一次性”密钥我可以在网址中使用来附加一些随机字符串?或者有没有办法告诉 Hta 不要缓存任何内容(在应用程序内,这应该适用于数百台计算机)?

I'm having a quite annoying problem, and came up with a quite ugly hack to make it work.

I develop an Hta application using a CouchDB database (for internal company use). The problem is there seems to be some very aggressive caching of the database queries, and it's been hard to come up with solutions.
So the updated data in the database just won't come up in the browser, who still has the previous request results in his cache, until the entire app is started anew.

Oh, and CouchDB (or it's mochiweb server) doesn't allow unknown GET variables, so the usual solution of appending some sort of timestamp just won't work.

I have found some sort of solution, but it's damn ugly. Solutions are:

  • Only open documents with latest revision number (easy and nice, won't work on views)
  • Use apache as forward proxy listening to 200+ ports, and select one at random on each read query. (that's the ugly one).

Hta accepts ajax calls to other ports (maybe even on other domains, strange behaviour), so it works nicely, I just have a 1/200 chance that new data won't come up, but that's still better then 1/1, I can live with that.

So what I'm asking is, is there a better solution to this ? Can I hack in to the mochiweb server to modify cache headers (and hope they're not going to be ignored) ? Is there a special unknown "throwaway" key I could use in the url's to append some random string ? Or is there a way to tell Hta not to cache anything (from within the app, this is supposed to work on hundreds of computers) ?

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

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

发布评论

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

评论(1

风追烟花雨 2024-08-10 10:13:32

它仍然很丑陋,但比你当前的 apache 设置稍微好一点,但是你不能使用 apache 重写规则来允许你在 url 上设置任意 no_cache 属性吗? apache 可以把它扔掉,这样 couchdb 就看不到它。

it's still ugly but slightly less ugly than your current apache setup but Can't you use an apache rewrite rule to allow you to set an arbitrary no_cache attribute on the url? apache can throw it away so couchdb won't see it.

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