First of all, thank you for maintaining this excellent library!
Background
Celery and Kombu are adding native support for Redis credential_provider parameter, which is essential for modern authentication methods like Azure Redis with Entra ID (formerly Azure AD).
Current Situation
It's currently possible to inject the credential provider using a custom client class:
# Use your own redis client class, should be compatible or subclass redis.Redis
CACHEOPS_CLIENT_CLASS = 'your.redis.ClientClass'
However, this creates two different ways of configuring the same thing across Celery, Kombu, and cacheops
Problem
It would be ideal to configure it using CACHEOPS_REDIS with credential_provider as a URL query parameter (consistent with Celery/Kombu):
CACHEOPS_REDIS = 'rediss://host:6380/15?credential_provider=module.MyCredentialProvider'
But this currently doesn't work because the credential_provider value is parsed as a string instead of being imported and instantiated as an object, resulting in:
AttributeError: 'str' object has no attribute 'get_credentials'
Additional Issue: from_url() Forces Dictionary Configuration
When using CACHEOPS_CLIENT_CLASS with credential_provider support, the current implementation forces users to abandon URL-based configuration and switch to dictionary format.
Additional Issue: from_url() Forces Dictionary Configuration
Cacheops checks if CACHEOPS_REDIS is a string (redis.py line 48-49):
if isinstance(settings.CACHEOPS_REDIS, str):
return client_class.from_url(settings.CACHEOPS_REDIS)The `from_url()` method:
- Parses URL query parameters as strings
- Creates a
ConnectionPool internally with those parsed string values
- By the time the custom client's
__init__ runs, the pool is already created WITHOUT the credential_provider
This means even if you try to inject the credential_provider in your custom client's __init__, it's too late—the connection pool is already instantiated.
Suggestions
Option 1: Add support for parsing and instantiating credential_provider from URL parameters (to match Celery/Kombu behavior).
Option 2: At minimum, update the documentation with an example showing how to use CACHEOPS_CLIENT_CLASS with a custom client class to inject credential providers.
This would help users implement token-based authentication (Azure Entra ID, AWS IAM, etc.) consistently across their Django/Celery stack.
Thanks a lot!
First of all, thank you for maintaining this excellent library!
Background
Celery and Kombu are adding native support for Redis
credential_providerparameter, which is essential for modern authentication methods like Azure Redis with Entra ID (formerly Azure AD).Current Situation
It's currently possible to inject the credential provider using a custom client class:
However, this creates two different ways of configuring the same thing across Celery, Kombu, and cacheops
Problem
It would be ideal to configure it using CACHEOPS_REDIS with credential_provider as a URL query parameter (consistent with Celery/Kombu):
But this currently doesn't work because the credential_provider value is parsed as a string instead of being imported and instantiated as an object, resulting in:
Additional Issue:
from_url()Forces Dictionary ConfigurationWhen using
CACHEOPS_CLIENT_CLASSwithcredential_providersupport, the current implementation forces users to abandon URL-based configuration and switch to dictionary format.Additional Issue:
from_url()Forces Dictionary ConfigurationCacheops checks if
CACHEOPS_REDISis a string (redis.py line 48-49):ConnectionPoolinternally with those parsed string values__init__runs, the pool is already created WITHOUT the credential_providerThis means even if you try to inject the
credential_providerin your custom client's__init__, it's too late—the connection pool is already instantiated.Suggestions
Option 1: Add support for parsing and instantiating credential_provider from URL parameters (to match Celery/Kombu behavior).
Option 2: At minimum, update the documentation with an example showing how to use CACHEOPS_CLIENT_CLASS with a custom client class to inject credential providers.
This would help users implement token-based authentication (Azure Entra ID, AWS IAM, etc.) consistently across their Django/Celery stack.
Thanks a lot!