couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Goodall (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-4) Use HTTP Etags for cache support
Date Tue, 24 Mar 2009 11:19:50 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12688643#action_12688643
] 

Matt Goodall commented on COUCHDB-4:
------------------------------------

The view etags are not unique enough to work correctly. If a database is deleted and created
with the same name, and the same number of documents is added then the etag does not change
and caching breaks. There needs to be some database uid included in the etag.

$ curl -X "PUT" http://localhost:5984/test
{"ok":true}
$ curl -X "POST" -d "{}" http://localhost:5984/test
{"ok":true,"id":"9a59fd2772c04b75b9584fe48227e55b","rev":"1-2431529710"}
$ nc localhost 5984
GET /test/_all_docs HTTP/1.0

HTTP/1.0 200 OK
Server: CouchDB/0.9.0a (Erlang OTP/R12B)
Etag: "40KWB93PS9PRNQP491WC04H50"
Date: Tue, 24 Mar 2009 10:51:27 GMT
Content-Type: text/plain;charset=utf-8
Cache-Control: must-revalidate

{"total_rows":1,"offset":0,"rows":[
{"id":"9a59fd2772c04b75b9584fe48227e55b","key":"9a59fd2772c04b75b9584fe48227e55b","value":{"rev":"1-2431529710"}}
]}
$ curl -X "DELETE" http://localhost:5984/test
{"ok":true}
$ curl -X "PUT" http://localhost:5984/test
{"ok":true}
$ curl -X "POST" -d "{}" http://localhost:5984/test
{"ok":true,"id":"6c4e1a7b9a8442beaa6065489bfe0d0b","rev":"1-4205788982"}
$ nc localhost 5984
GET /test/_all_docs HTTP/1.0

HTTP/1.0 200 OK
Server: CouchDB/0.9.0a (Erlang OTP/R12B)
Etag: "40KWB93PS9PRNQP491WC04H50"
Date: Tue, 24 Mar 2009 10:52:01 GMT
Content-Type: text/plain;charset=utf-8
Cache-Control: must-revalidate

{"total_rows":1,"offset":0,"rows":[
{"id":"6c4e1a7b9a8442beaa6065489bfe0d0b","key":"6c4e1a7b9a8442beaa6065489bfe0d0b","value":{"rev":"1-4205788982"}}
]}


> Use HTTP Etags for cache support
> --------------------------------
>
>                 Key: COUCHDB-4
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-4
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>            Reporter: Noah Slater
>            Assignee: Chris Anderson
>            Priority: Blocker
>             Fix For: 0.9
>
>
> CouchDb currently puts a number of headers in HTTP responses that disable
> any caching. However, the docid and rev that are part of every document
> would make it extremely easy to instead generate solid Etag headers, and
> then return 204 Not Modified responses for GET and HEAD requests if the
> client sends along the most current Etag value.
> For example, instead of:
> HTTP/1.1 200 OK
> Server: inets/develop
> Date: Sat, 15 Sep 2007 11:21:41 GMT
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: Sat, 15 Sep 2007 11:21:41 GMT
> CouchDB should return something like:
> HTTP/1.1 200 OK
> Server: inets/develop
> Date: Sat, 15 Sep 2007 11:21:41 GMT
> Cache-Control: must-revalidate
> Etag: ${docid}@${rev}
> Sufficiently sophisticated clients (such as Python httplib2) could then use
> If-None-Match to perform conditional GET requests.
> Thinking about it again, as the docid is already in the URL, only the rev
> is needed in the Etag headers.
> --
> Comment 1 by cml...@gmx.de, Oct 01, 2007
> See also http://intertwingly.net/blog/2007/09/24/Tests-Id-Like-CouchDB-to-Pass#etag

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message