msight_core.utils
msight_core.utils
get_redis_client()
Get a Redis client with support for various configurations.
Supports: - Unix socket connections - TCP connections (standalone) - Redis Cluster mode - Username/password authentication - TLS/SSL connections with optional client certificates
Environment Variables
MSIGHT_REDIS_MESSAGE_BROKER_UNIX_SOCKET_PATH: Path to Unix socket (takes precedence) MSIGHT_REDIS_MESSAGE_BROKER_USE_CLUSTER: Enable cluster mode ("true"/"1"/"yes") MSIGHT_REDIS_MESSAGE_BROKER_CLUSTER_NODES: Cluster nodes as list string (e.g., "['host1:6379', 'host2:6379']") MSIGHT_REDIS_MESSAGE_BROKER_HOST: Redis host (default: localhost) MSIGHT_REDIS_MESSAGE_BROKER_PORT: Redis port (default: 6379) MSIGHT_REDIS_MESSAGE_BROKER_DB: Database number (default: 0, ignored in cluster mode) MSIGHT_REDIS_MESSAGE_BROKER_USERNAME: Redis username (optional) MSIGHT_REDIS_MESSAGE_BROKER_PASSWORD: Redis password (optional) MSIGHT_REDIS_MESSAGE_BROKER_USE_TLS: Enable TLS/SSL ("true"/"1"/"yes") MSIGHT_REDIS_MESSAGE_BROKER_TLS_CERT_FILE: Client certificate file path (optional) MSIGHT_REDIS_MESSAGE_BROKER_TLS_KEY_FILE: Client key file path (optional) MSIGHT_REDIS_MESSAGE_BROKER_TLS_CA_CERT_FILE: CA certificate file path (optional)
Returns:
| Type | Description |
|---|---|
Redis | RedisCluster
|
redis.Redis | redis.RedisCluster: Configured Redis client |