#33681: Cache OPTIONS are not passed to the Redis client.
-------------------------------------+------------------------------------
     Reporter:  Ben Picolo           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  4.0
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * cc: Nick Pope (added)
 * type:  Cleanup/optimization => Bug
 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report. Agreed, we should pass all options to the Redis
 client. Would you like to prepare a patch? It's probably enough to pass
 the OPTIONS to the underlying client, e.g.

 {{{#!diff
 diff --git a/django/core/cache/backends/redis.py
 b/django/core/cache/backends/redis.py
 index e0d30784ff..51701b77b3 100644
 --- a/django/core/cache/backends/redis.py
 +++ b/django/core/cache/backends/redis.py
 @@ -35,6 +35,7 @@ class RedisCacheClient:
          db=None,
          pool_class=None,
          parser_class=None,
 +        **options,
      ):
          import redis

 @@ -58,6 +59,7 @@ class RedisCacheClient:
              parser_class = import_string(parser_class)
          parser_class = parser_class or self._lib.connection.DefaultParser

 +        self._options = options
          self._pool_options = {"parser_class": parser_class, "db": db}

      def _get_connection_pool_index(self, write):
 @@ -81,7 +83,7 @@ class RedisCacheClient:
          # cache client can be implemented which might require the key to
 select
          # the server, e.g. sharding.
          pool = self._get_connection_pool(write)
 -        return self._client(connection_pool=pool)
 +        return self._client(connection_pool=pool, **self._options)

      def add(self, key, value, timeout):
          client = self.get_client(key, write=True)
 }}}

 Marking as a release blocker as this is as a bug in the new feature.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33681#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180979c5a35-2c99546c-be92-4201-bc22-043c4f88fe71-000000%40eu-central-1.amazonses.com.

Reply via email to