The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(auth_checks.py): bump in-memory cache ttl for user objects to 60s
Krrish Dholakia0119c1efaa39
diff --git a/litellm/constants.py b/litellm/constants.pyindex fba57a2bf9d..50df19bb7f9 100644--- a/litellm/constants.py+++ b/litellm/constants.py@@ -714,3 +714,6 @@ SECRET_MANAGER_REFRESH_INTERVAL = int()LITELLM_SETTINGS_SAFE_DB_OVERRIDES = ["default_internal_user_params"]SPECIAL_LITELLM_AUTH_TOKEN = ["ui-token"]+DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL = int(+ os.getenv("DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL", 60)+)diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.pyindex 05a47dd359f..8653e40c7a5 100644--- a/litellm/proxy/auth/auth_checks.py+++ b/litellm/proxy/auth/auth_checks.py@@ -20,7 +20,11 @@ import litellmfrom litellm._logging import verbose_proxy_loggerfrom litellm.caching.caching import DualCachefrom litellm.caching.dual_cache import LimitedSizeOrderedDict-from litellm.constants import DEFAULT_IN_MEMORY_TTL, DEFAULT_MAX_RECURSE_DEPTH+from litellm.constants import (+ DEFAULT_IN_MEMORY_TTL,+ DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL,+ DEFAULT_MAX_RECURSE_DEPTH,+)from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_providerfrom litellm.proxy._types import (RBAC_ROLES,@@ -727,7 +731,9 @@ async def get_user_object(# save the user object to cacheawait user_api_key_cache.async_set_cache(- key=user_id, value=response_dict, ttl=DEFAULT_IN_MEMORY_TTL+ key=user_id,+ value=response_dict,+ ttl=DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL,)# save to db access time