在Couchdb中压缩(Gzip或Deflate)显示,列表和视图 [英] Compressing (Gzip or Deflate) Shows, Lists and views in Couchdb

查看:81
本文介绍了在Couchdb中压缩(Gzip或Deflate)显示,列表和视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎当使用正确的标头请求时,ouchdb会自动压缩其所有_attachments.但不幸的是,视图,显示或列表不会发生这种情况.

It seems that couchdb automatically compress all its _attachments when requested with the correct header. But unfortunately this doesn't happen for views, show or lists.

在将结果返回给客户端之前,有什么方法可以实现压缩?

Is there any way to achieve a compression before returning the result to the client?

正在使用第三方库,例如 deflatejs (尚未测试)是不好的方法吗?

Is using a third party library like deflatejs (didn't test it yet) a bad approach?

谢谢

推荐答案

您当然可以在show和list函数中使用js-deflate,但不能在view函数中使用.我还怀疑这样做效率不高(只是猜测,如果需要数字就对其进行测试).

You can certainly use js-deflate in show and list functions, but you cannot do it in view functions. I also suspect it would be inefficient (just a guess, test it if you want numbers).

直到CouchDB不支持gzip编码,最简单的解决方案是CouchDB前面的反向代理进行压缩.例如,您可以将nginx与 HttpGzipModule 一起使用.

Until CouchDB does not support gzip encoding, the easiest solution is to put a reverse proxy in front of CouchDB to do the compression. For example you can use nginx with the HttpGzipModule.

这篇关于在Couchdb中压缩(Gzip或Deflate)显示,列表和视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆