Redis Semantic Cache
The Redis cache backend provides persistent, high-performance semantic caching using Redis Stack with RediSearch. This solution offers excellent performance with lower operational complexity compared to specialized vector databases.
Overviewâ
Redis cache is ideal for:
- Production environments requiring fast response times
- Single-instance or clustered Redis deployments
- Medium to large-scale applications with efficient memory usage
- Persistent storage with optional TTL expiration
- Simplified operations with familiar Redis tooling
Architectureâ
Configurationâ
Redis Backend Configurationâ
Configure in config/semantic-cache/redis.yaml:
# config/semantic-cache/redis.yaml
connection:
address: "localhost:6379"
password: ""
db: 0
pool_size: 10
max_retries: 3
dial_timeout_ms: 5000
read_timeout_ms: 3000
write_timeout_ms: 3000
tls:
enabled: false
index:
name: "semantic_cache_idx"
prefix: "doc:"
vector_field:
name: "embedding"
dimension: 384 # Must match embedding model dimension
algorithm: "HNSW"
metric_type: "COSINE"
hnsw:
m: 16
ef_construction: 200
ef_runtime: 10
search:
top_k: 5
development:
drop_index_on_startup: false
log_level: "info"