-
-
Notifications
You must be signed in to change notification settings - Fork 437
Description
The parser section of django_redis' documentation states that in order to use hiredis the PARSER_CLASS
option must be set to redis.connection.HiredisParser
or redis.connection._HiredisParser
respectively.
I think this information is outdated, since django-redis returns redis.connection.DefaultParser
if PARSER_CLASS
is not explicitly set (see here).
redis-py has always set DefaultParser
to either redis.connection._HiredisParser
or redis.connection._RESP2Parser
during module initialization, depending on the availability of hiredis.
So, If you want to use hiredis with django-redis, the documentation is outdated. There are no extra steps to follow, except making sure that hiredis is available in your environment.
All of this can be proven on a Django shell:
$ python manage.py shell
Python 3.11.10 (main, Sep 12 2024, 21:11:07) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> from redis.connection import DefaultParser
>>> DefaultParser
<class 'redis._parsers.hiredis._HiredisParser'>
>>> assert 'PARSER_CLASS' not in settings.CACHES['default']['OPTIONS']
>>>