From d5689a6f0059c648e2e2141cd2690444f312abf3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 10 Feb 2025 11:59:29 -0800 Subject: [PATCH] update RedisClusterCache --- litellm/caching/caching.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/litellm/caching/caching.py b/litellm/caching/caching.py index f7842ad48a3..7b98ed70f72 100644 --- a/litellm/caching/caching.py +++ b/litellm/caching/caching.py @@ -41,6 +41,7 @@ from .dual_cache import DualCache # noqa from .in_memory_cache import InMemoryCache from .qdrant_semantic_cache import QdrantSemanticCache from .redis_cache import RedisCache +from .redis_cluster import RedisClusterCache from .redis_semantic_cache import RedisSemanticCache from .s3_cache import S3Cache @@ -158,14 +159,23 @@ class Cache: None. Cache is set as a litellm param """ if type == LiteLLMCacheType.REDIS: - self.cache: BaseCache = RedisCache( - host=host, - port=port, - password=password, - redis_flush_size=redis_flush_size, - startup_nodes=redis_startup_nodes, - **kwargs, - ) + if redis_startup_nodes: + self.cache: BaseCache = RedisClusterCache( + host=host, + port=port, + password=password, + redis_flush_size=redis_flush_size, + startup_nodes=redis_startup_nodes, + **kwargs, + ) + else: + self.cache: BaseCache = RedisCache( + host=host, + port=port, + password=password, + redis_flush_size=redis_flush_size, + **kwargs, + ) elif type == LiteLLMCacheType.REDIS_SEMANTIC: self.cache = RedisSemanticCache( host=host,