Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated documentation about hiredis #750

Open
flbraun opened this issue Sep 18, 2024 · 0 comments
Open

Outdated documentation about hiredis #750

flbraun opened this issue Sep 18, 2024 · 0 comments
Labels

Comments

@flbraun
Copy link

flbraun commented Sep 18, 2024

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']
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant