Redis
Redis provides high-performance in-memory vector storage using RediSearch-compatible APIs, ideal for applications requiring sub-millisecond response times and fast semantic search capabilities. Valkey deployments that expose compatibleFT.* commands are supported through the same configuration.
Key Features
- High Performance: Sub-millisecond cache retrieval with Redis’s in-memory storage
- Cost Effective: Open-source solution with no licensing costs
- HNSW Algorithm: Fast vector similarity search with excellent recall rates
- Connection Pooling: Advanced connection management for high-throughput applications
- TTL Support: Automatic expiration of cached entries
- Streaming Support: Full streaming response caching with proper chunk ordering
- Flexible Filtering: Advanced metadata filtering with exact string matching
Setup & Installation
Redis Cloud:- Sign up at cloud.redis.io
- Create a new database with RediSearch module enabled
- Get your connection details
Configuration Options
- Go SDK
- config.json
Redis-Specific Features
Vector Search Algorithm: Redis uses the HNSW (Hierarchical Navigable Small World) algorithm for vector similarity search, which provides:- Fast Search: O(log N) search complexity
- High Accuracy: Excellent recall rates for similarity search
- Memory Efficient: Optimized for in-memory operations
- Cosine Similarity: Uses cosine distance metric for semantic similarity
Performance Optimization
Connection Pool Tuning: For high-throughput applications, tune the connection pool settings:- TTL: Use appropriate TTL values to prevent memory bloat
- Namespace Cleanup: Regularly clean up unused namespaces
Production Considerations
TLS and Cluster Mode: Set
use_tls: true to enable TLS encryption for the Redis connection, and insecure_skip_verify: true if using self-signed certificates. Set cluster_mode: true when connecting to a Redis Cluster endpoint. When cluster mode is enabled, the db field must be 0 (Redis Cluster does not support database selection).Search Module Required: Redis/Valkey integration requires a search module/API that supports
FT.* commands (index creation and vector search). If FT.INFO or FT.SEARCH is unavailable, semantic caching will not work.
