Skip to content

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]

refactor(cache-valkey-semantic): reuse cache-redis connection layer

Yujong Leeb6b0e58ba399
diff --git a/litellm-rust/crates/cache-valkey-semantic/src/lib.rs b/litellm-rust/crates/cache-valkey-semantic/src/lib.rs
index dfc6c82596c..2bd4bd71bce 100644
--- a/litellm-rust/crates/cache-valkey-semantic/src/lib.rs
+++ b/litellm-rust/crates/cache-valkey-semantic/src/lib.rs
@@ -5,7 +5,10 @@ use std::{
};
use litellm_cache::{BaseCache, CacheCodec, CacheConnectionResult, Error, SemanticCacheContext};
-use litellm_cache_redis::connection::{ConnectionRef, Connections};
+use litellm_cache_redis::{
+ RedisTopology,
+ connection::{ConnectionRef, Connections},
+};
use litellm_cache_response::CacheEntry;
use serde_json::Value;
use sha2::{Digest, Sha256};
@@ -37,9 +40,6 @@ struct IndexState {
similarity_threshold: f64,
}
-const REDIS_TIMEOUT: Duration = Duration::from_secs(5);
-const REDIS_POOL_SIZE: u32 = 16;
-
pub struct ValkeySemanticCache<
E: Embedder,
S: CacheCodec<Value = CacheEntry>,
@@ -64,7 +64,7 @@ where
config: ValkeySemanticConfig,
) -> Result<Self, Error> {
Ok(Self {
- connections: Arc::new(Connections::pooled(url, REDIS_TIMEOUT, REDIS_POOL_SIZE)?),
+ connections: Arc::new(Connections::open(url, &RedisTopology::Standalone)?),
embedder,
codec,
config,