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
add always read redis test
Ishaan Jaff657b7eef823f
diff --git a/litellm/tests/test_caching.py b/litellm/tests/test_caching.pyindex 9b859b451a9..db2e7e1c414 100644--- a/litellm/tests/test_caching.py+++ b/litellm/tests/test_caching.py@@ -1958,3 +1958,30 @@ async def test_cache_default_off_acompletion():)print(f"Response4: {response4}")assert response3.id == response4.id+++async def test_dual_cache_uses_redis():+ """++ - Store diff values in redis and in memory cache+ - call get cache+ - Assert that value from redis is used+ """+ litellm.set_verbose = True+ from litellm.caching import DualCache, RedisCache++ current_usage = uuid.uuid4()++ _cache_obj = DualCache(redis_cache=RedisCache(), always_read_redis=True)++ # set cache+ await _cache_obj.async_set_cache(key=f"current_usage: {current_usage}", value=10)++ # modify value of in memory cache+ _cache_obj.in_memory_cache.cache_dict[f"current_usage: {current_usage}"] = 1++ # get cache+ value = await _cache_obj.async_get_cache(key=f"current_usage: {current_usage}")+ print("value from dual cache", value)+ assert value == 10