fix(proxy_server.py): allow user to set in-memory + redis ttl

addresses - https://github.com/BerriAI/litellm/issues/2700
This commit is contained in:
Krrish Dholakia 2024-04-01 19:13:23 -07:00
parent ceabf726b0
commit 203e2776f8
3 changed files with 22 additions and 2 deletions

View file

@ -1914,6 +1914,12 @@ class ProxyConfig:
global redis_usage_cache
from litellm import Cache
if "default_in_memory_ttl" in cache_params:
litellm.default_in_memory_ttl = cache_params["default_in_memory_ttl"]
if "default_in_redis_ttl" in cache_params:
litellm.default_redis_ttl = cache_params["default_in_redis_ttl"]
litellm.cache = Cache(**cache_params)
if litellm.cache is not None and isinstance(litellm.cache.cache, RedisCache):