From d90f3d558ed7fd38df4912309b7803ca6641f475 Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Sat, 14 Feb 2026 08:46:07 +0530 Subject: [PATCH] Update litellm/proxy/utils.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/proxy/utils.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 4084284f7d0..f7e32869a23 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -2075,11 +2075,8 @@ async def _lookup_deprecated_key( now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, ) return deprecated_row.active_token_id - # Cache negative result to avoid repeated DB lookups for invalid tokens - _deprecated_key_cache[hashed_token] = ( - None, - now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, - ) + # Only cache positive results; negative lookups are fast on indexed columns + # and caching them risks evicting real deprecated key entries. except Exception as e: verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e)