summaryrefslogtreecommitdiff
path: root/redis/utils.py
diff options
context:
space:
mode:
authorSergey Prokazov <prokazov@users.noreply.github.com>2023-02-06 05:46:45 -0600
committerGitHub <noreply@github.com>2023-02-06 13:46:45 +0200
commitffbe879549c8a212ba70e25ee9a0367187753669 (patch)
tree2503035cf4bb98b627337b29116c0dc382eb07da /redis/utils.py
parent31a1c0b7908e157f80e39a00597defa4d76c5ca1 (diff)
downloadredis-py-ffbe879549c8a212ba70e25ee9a0367187753669.tar.gz
Use hiredis::pack_command to serialized the commands. (#2570)
* Implemented pack command and pack bytes * 1) refactored the command packer construction process 2) now hiredis.pack_bytes is the default choice. Though it's still possible to run redisrs-py (fix the flag in utils.py) or hiredis.pack_command (flag in connection.py) * Switch to hiredis.pack_command * Remove the rust extension module. * 1) Introduce HIREDIS_PACK_AVAILABLE environment variable. 2) Extract serialization functionality out of Connection class. * 1) Fix typo. 2) Add change log entry. 3) Revert the benchmark changes * Ditch the hiredis version check for pack_command. * Fix linter errors * Revert version changes * Fix linter issues * Looks like the current redis-py version is 4.4.1 --------- Co-authored-by: Sergey Prokazov <sergey.prokazov@redis.com>
Diffstat (limited to 'redis/utils.py')
-rw-r--r--redis/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/redis/utils.py b/redis/utils.py
index 693d4e6..d95e62c 100644
--- a/redis/utils.py
+++ b/redis/utils.py
@@ -7,8 +7,10 @@ try:
# Only support Hiredis >= 1.0:
HIREDIS_AVAILABLE = not hiredis.__version__.startswith("0.")
+ HIREDIS_PACK_AVAILABLE = hasattr(hiredis, "pack_command")
except ImportError:
HIREDIS_AVAILABLE = False
+ HIREDIS_PACK_AVAILABLE = False
try:
import cryptography # noqa