From 3cf31e0c4de52b48ed49fe33673576d8c28847c0 Mon Sep 17 00:00:00 2001 From: Amr Mohammed Date: Mon, 28 Sep 2026 10:02:16 +0300 Subject: [PATCH] fix(caching): bound warning registry to prevent unbounded growth --- litellm/caching/caching.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/litellm/caching/caching.py b/litellm/caching/caching.py index 088922046e1..4a7ed6a76e9 100644 --- a/litellm/caching/caching.py +++ b/litellm/caching/caching.py @@ -393,13 +393,18 @@ class Cache: continue # ignore None params param_value = kwargs[param] cache_key += f"{param}: {param_value}" - elif kwargs[param] is not None and param not in _warned_dropped_cache_params: + elif ( + kwargs[param] is not None + and param not in _warned_dropped_cache_params + and len(_warned_dropped_cache_params) < 100 + ): _warned_dropped_cache_params.add(param) verbose_logger.warning( "litellm.cache: provider-specific param '%s' is excluded from the cache key by default, " "so requests differing only in '%s' will return the same cached response. " "Set litellm.enable_caching_on_provider_specific_optional_params=True to include it in the key.", - param, param, + param, + param, ) if is_semantic_cache: