Make use of HTTP validation header
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-Matchheader in our request. Maybe as an optional parameter. - retrieve the
etagof the response and make it accessible when using the Query API. Currently that header is only accessible when using the HTTP client directly (like theStreamClientorSocketClient),
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
Such a feature should be very usable :+1:
This should be implemented in a CachingClient using 'doctrine/cache' as a caching backend IMHO.
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.