Merge pull request #2789 from BerriAI/litellm_set_ttl

fix(proxy_server.py): allow user to set in-memory + redis ttl
This commit is contained in:
Krish Dholakia 2024-04-02 08:53:34 -07:00 committed by GitHub
commit 7233e5ab25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View file

@ -1908,6 +1908,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_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):