Changes between Version 2 and Version 3 of Ticket #33681


Ignore:
Timestamp:
May 5, 2022, 10:10:33 AM (3 years ago)
Author:
Ben Picolo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33681 – Description

    v2 v3  
    33I discovered unintentionally that there's no default socket_timeout set for Redis cache connections. This is an issue on it's own (unsafe default that's a particularly hard issue to track down), but in trying to set those timeouts, I hit some tough edges of documentation/usage.
    44
    5 The cache documentation says that the OPTIONS object is passed to the third-party connection class for connections backed by third-party libraries [https://docs.djangoproject.com/en/4.0/topics/cache/#:~:text=cache%20backends%20backed%20by%20a%20third%2Dparty%20library%20will%20pass%20their%20options%20directly%20to%20the%20underlying%20cache%20library is passed to the underlying library connection object]. This is reaffirmed for the redis cache specifically [https://docs.djangoproject.com/en/4.0/topics/cache/#:~:text=The%20Memcached%20and%20Redis%20backends%20pass%20the%20contents%20of%20OPTIONS%20as%20keyword%20arguments%20to%20the%20client%20constructors here].
     5The cache documentation says that the OPTIONS object is passed to the third-party connection class for connections backed by third-party libraries [https://docs.djangoproject.com/en/4.0/topics/cache/#:~:text=cache%20backends%20backed%20by%20a%20third%2Dparty%20library%20will%20pass%20their%20options%20directly%20to%20the%20underlying%20cache%20 for connections backed by third-party libraries]. This is reaffirmed for the redis cache specifically [https://docs.djangoproject.com/en/4.0/topics/cache/#:~:text=The%20Memcached%20and%20Redis%20backends%20pass%20the%20contents%20of%20OPTIONS%20as%20keyword%20arguments%20to%20the%20client%20constructors here].
    66
    77Right now, though, these OPTIONS are passed to the [https://github.com/django/django/blob/7119f40c9881666b6f9b5cf7df09ee1d21cc8344/django/core/cache/backends/redis.py#L30 first-party RedisCacheClient object], so you can't pass in options expected by the redis connection pool [https://github.com/redis/redis-py/blob/master/redis/connection.py#L1283 link]. In that sense, RedisCacheClient is being treated as a "first-party" cache according to these docs, but it defers directly to the redis library.
Back to Top