如何比较redis官网列出的5种python客户端

发布于 2022-09-01 15:23:43 字数 189 浏览 9 评论 0

我想找出最适合的redis Python客户端,项目采用Django框架。看官网上说有五种,包括brukva、desir、redis-py、txredis、txredisapi。我看网上用的最多的是redis-py,请问它是不是适合于所有框架呢?因为有些写了针对特定的python框架,有没有文档什么的比较过这5个客户端的连接性能呢?从而得出结论哪个是最好的?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

メ斷腸人バ 2022-09-08 15:23:43

redis-py,redis官方也推荐使用, https://redis.io/client 上提到有一颗星⭐的都是推荐的客户端库。

在redis-py的 文档 中可以看到这么一段内容:

Parser classes provide a way to control how responses from the Redis server are parsed. redis-py ships with two parser classes, the PythonParser and the HiredisParser. By default, redis-py will attempt to use the HiredisParser if you have the hiredis module installed and will fallback to the PythonParser otherwise.

译:Parser类可以控制如何解析Redis服务器端响应的内容。redis-py提供两个parser类,PythonParser和HiredisParser。如果你已经安装了hiredis模块,redis-py默认会尝试使用HiredisParser,否则会使用PythonParser。

Hiredis is a C library maintained by the core Redis team. Pieter Noordhuis was kind enough to create Python bindings. Using Hiredis can provide up to a 10x speed improvement in parsing responses from the Redis server. The performance increase is most noticeable when retrieving many pieces of data, such as from LRANGE or SMEMBERS operations.

译:Hiredis是一个C语言的库,是由Redis核心团队维护的。Pieter Noordhuis还写了一个Python版本的Hiredis(即hireids-py)。使用Hiredis可以使得redis客户端解析服务端响应内容的速度提升10倍。而且当执行检索多条数据时性能更显著,如LRANGE、SMEMBERS等。

Hiredis is available on PyPI, and can be installed via pip or easy_install just like redis-py.

译:Hiredis可以在PyPI上找到,你可以使用easy_install或pip来安装(hiredis-py)。

$ pip install hiredis
or
$ easy_install hiredis
因此,安装redis-py同时安装hiredis-py,使用redis-py的时候会提升性能

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文