Skip to main content

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 compatible FT.* 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
Local Redis with RediSearch:
Local Valkey Bundle:

Configuration Options

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
Connection Pool Management: Redis provides extensive connection pool configuration:

Performance Optimization

Connection Pool Tuning: For high-throughput applications, tune the connection pool settings:
Memory Optimization:
  • TTL: Use appropriate TTL values to prevent memory bloat
  • Namespace Cleanup: Regularly clean up unused namespaces
Batch Operations: Redis supports efficient batch operations:

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.
Production Considerations:
  • Use Redis AUTH for production deployments
  • Configure appropriate connection timeouts
  • Monitor memory usage and set appropriate TTL values
For the VectorStore interface API and usage examples, see Vector Store Architecture. For semantic caching setup, see Semantic Caching.