From 0b7f8265d64ddbb8fec4de9574013ad5ea8bf235 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Sat, 9 Dec 2023 15:20:08 -0800 Subject: [PATCH] (fix) router - only init cache when its none --- litellm/router.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/router.py b/litellm/router.py index 5a0cf8a371..1721a381b1 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -131,7 +131,9 @@ class Router: cache_config.update(cache_kwargs) redis_cache = RedisCache(**cache_config) if cache_responses: - litellm.cache = litellm.Cache(type=cache_type, **cache_config) + if litellm.cache is None: + # the cache can be initialized on the proxy server. We should not overwrite it + litellm.cache = litellm.Cache(type=cache_type, **cache_config) self.cache_responses = cache_responses self.cache = DualCache(redis_cache=redis_cache, in_memory_cache=InMemoryCache()) # use a dual cache (Redis+In-Memory) for tracking cooldowns, usage, etc. ### ROUTING SETUP ###