couchdb-client icon indicating copy to clipboard operation
couchdb-client copied to clipboard

Make use of HTTP validation header

Open e42sh opened this issue 12 years ago • 2 comments

Currently each requests send to couchdb lacks of a etag validation header. This forces couchdb to regenerate a new response instead of sending only a header back. If we have the possibility to of sending such Requests, we could gain performance and throughput on the php application, couchdb and network usage).

If we could send validation header in the HTTP request, couchdb would send a HTTP 304 Not Modified response back. Such responses would also be very helpful when using a gateway cache (e.g. varnish) infront of couchdb.

Something we would need here, is the possibility to

  • send an If-None-Match header in our request. Maybe as an optional parameter.
  • retrieve the etag of the response and make it accessible when using the Query API. Currently that header is only accessible when using the HTTP client directly (like the StreamClient or SocketClient),

Then a wrapper, like the LoggingClient, could be used to either put it into a local cache like APC or Memcached or just proxy the header to the client.

What do you think @beberlei?

Regards, Martin

e42sh avatar Feb 08 '13 10:02 e42sh

Such a feature should be very usable :+1: This should be implemented in a CachingClient using 'doctrine/cache' as a caching backend IMHO.

h4cc avatar Feb 26 '15 20:02 h4cc

Indeed sounds useful, questioning if it makes sense to use another backend to Cache, but it would work with ArrayCache or not? To avoid doing the same CouchDB requests in the same PHP request.

beberlei avatar Nov 11 '15 20:11 beberlei