diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index cb53b4baaf..1c41d79fc1 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -13,7 +13,7 @@ litellm_settings: cache: true cache_params: type: redis - # callbacks: ["batch_redis_requests"] + callbacks: ["batch_redis_requests"] general_settings: master_key: sk-1234 diff --git a/litellm/proxy/hooks/batch_redis_get.py b/litellm/proxy/hooks/batch_redis_get.py index 25589e0df8..71588c9d40 100644 --- a/litellm/proxy/hooks/batch_redis_get.py +++ b/litellm/proxy/hooks/batch_redis_get.py @@ -85,10 +85,10 @@ class _PROXY_BatchRedisRequests(CustomLogger): ) ## Add to cache - for key, value in key_value_dict.items(): - _cache_key = f"{cache_key_name}:{key}" - cache.in_memory_cache.cache_dict[_cache_key] = value - + if len(key_value_dict.items()) > 0: + await cache.in_memory_cache.async_set_cache_pipeline( + cache_list=list(key_value_dict.items()), ttl=60 + ) ## Set cache namespace if it's a miss data["metadata"]["redis_namespace"] = cache_key_name except HTTPException as e: