You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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']
>>>
The text was updated successfully, but these errors were encountered:
The parser section of django_redis' documentation states that in order to use hiredis the
PARSER_CLASS
option must be set toredis.connection.HiredisParser
orredis.connection._HiredisParser
respectively.I think this information is outdated, since django-redis returns
redis.connection.DefaultParser
ifPARSER_CLASS
is not explicitly set (see here).redis-py has always set
DefaultParser
to eitherredis.connection._HiredisParser
orredis.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:
The text was updated successfully, but these errors were encountered: