Question

I'm using Couchdb (hosted by Cloudant). One of the cool things about Couchdb is that when you query a document, it supports standard http etag-based caching (the etag is the document's _rev field).

However, I notice that when I request a view, the etag is different on each request, even when the underlying documents haven't changed, which defeats the purpose of using etags to minimize traffic from the database server.

Is there a setting I need to tweak somewhere to fix this?

Edit:

Here's a link to my design document: https://codeliberate.cloudant.com/crowdfunder/_design/xLgxNgK_dXEQxHbzmEiCbWE_wackXLk83xDp28ShH8Q_

And here's link to the view output: https://codeliberate.cloudant.com/crowdfunder/_design/xLgxNgK_dXEQxHbzmEiCbWE_wackXLk83xDp28ShH8Q_/_view/xLgxNgK_dXEQxHbzmEiCbWE_wackXLk83xDp28ShH8Q_

Each time I refresh the view in Chrome and use the Network console to examine the headers sent by the server, I get a different etag (for instance, the last three times I refreshed I got 34c474c51f0beb87fa13755b9594c52a, 39da8a25e57ba660da6a905d8374b26f, and 6c5862d8d4a9375d484aaa1c1c9e8321 respectively). Pretty sure the underlying data didn't change in between refreshes.

Était-ce utile?

La solution

Currently, Cloudant supports ETag caching on individual documents (where the ETag is the document's _rev field), but not on views :(

Autres conseils

What you describe is quite surprising... As long as I don't change the documents, I get the same etag ever and ever for a view. And it works very well with the "If-None-Match" header.

Are you sure you use a "real view" and not:

  • a temporary view?
  • a list?
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top