jazzband/django-redis

Outdated documentation about hiredis

Open

#750 opened on Sep 18, 2024

View on GitHub
 (3 comments) (1 reaction) (1 assignee)Python (452 forks)auto 404
documentationgood first issue

Repository metrics

Stars
 (3,075 stars)
PR merge metrics
 (PR metrics pending)

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']
>>>

Contributor guide