diff options
| author | ar3ph <192461522+ar3ph@users.noreply.github.com> | 2026-02-02 13:26:18 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-03 06:40:29 -0500 |
| commit | 72ae25a9c2bb1a9e369e52e696a8b7d1a8df245e (patch) | |
| tree | fa3453118bfe116bb393153be80f6f52b1062add /django/core | |
| parent | 24a14860ced5c456522d69c16afd2c631cc0456f (diff) | |
Fixed #36879 -- Identified Django client in Redis client metadata.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/cache/backends/redis.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/django/core/cache/backends/redis.py b/django/core/cache/backends/redis.py index bbf070a375..727ea51f84 100644 --- a/django/core/cache/backends/redis.py +++ b/django/core/cache/backends/redis.py @@ -4,6 +4,7 @@ import pickle import random import re +import django from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils.functional import cached_property from django.utils.module_loading import import_string @@ -59,7 +60,19 @@ class RedisCacheClient: parser_class = import_string(parser_class) parser_class = parser_class or self._lib.connection.DefaultParser - self._pool_options = {"parser_class": parser_class, **options} + version = django.get_version() + if hasattr(self._lib, "DriverInfo"): + driver_info = self._lib.DriverInfo().add_upstream_driver("django", version) + driver_info_options = {"driver_info": driver_info} + else: + # DriverInfo is not available in this redis-py version. + driver_info_options = {"lib_name": f"redis-py(django_v{version})"} + + self._pool_options = { + "parser_class": parser_class, + **driver_info_options, + **options, + } def _get_connection_pool_index(self, write): # Write to the first server. Read from other servers if there are more, |
