如何禁用/关闭/刷新CouchDB缓存 [英] how to disable / turn-off / refresh couchdb caching
问题描述
我有一个列表,该列表对文档进行了一些基本认证。我遇到的问题是列表正在缓存,因此除非我更新修订版ID,否则用户将看不到他们具有访问权限。您如何显示非缓存列表?
I have a list that has some basic authentication on a document. The issue I am having is that the list is caching so the user will not see they have access unless I update the revision id. How do you show a non-cached list?
if (req.userCtx.name === doc.permissions.owner) {
return 'you have permission';
}
else {
return 'you do not';
}
我想它的完成方式是通过不缓存或更新ETAG或标题中的类似内容,但似乎无济于事。这是我的尝试,每次都会在头部发送一个新日期以使其不被缓存,但这是行不通的。
How I would imagine it done is by passing no-cache or update the ETAG or something of that sort in the header, but nothing seems to work. Here is an attempt I have that sends a new date in the head every time to make it not cache, but this doesn't work.
var date = new Date().getTime() + 'x';
start({code: 200, headers: {'Content-Type': 'text/html', 'date': date}});
任何想法都值得赞赏!
推荐答案
因此,在进行了更多挖掘之后,我发现了这一点:
So after a lot more digging I found this:
http://wiki.apache.org/couchdb/ Formatting_with_Show_and_List#ETags
切到重要部分:
- ETag由列表和显示处理
- 版本不超过1.2的用户必须具有角色,然后他们才能获得不同的ETag。
- 1.3将为每个用户名引入新的ETag。
希望这对某人有帮助。
这篇关于如何禁用/关闭/刷新CouchDB缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!