Redis Storage for Response API
The Redis storage backend provides persistent, distributed storage for Response API conversations. This solution offers excellent performance with automatic TTL expiration and support for both standalone and cluster deployments.
Overview
Redis storage is ideal for:
- Production environments requiring persistence across restarts
- Distributed deployments sharing state across multiple router instances
- Stateful conversations with automatic chain management
- TTL-based expiration for automatic cleanup
- High availability with cluster support
Configuration
Where to Configure
Response API storage is configured in config/config.yaml:
# config/config.yaml
response_api:
enabled: true
store_backend: "memory" # Default: "memory", Options: "redis", "milvus"
ttl_seconds: 86400 # 24 hours (default)
max_responses: 1000 # Memory store limit
To enable Redis storage, change store_backend to "redis" and add Redis configuration:
# config/config.yaml
response_api:
enabled: true
store_backend: "redis" # Switch to Redis
ttl_seconds: 2592000 # 30 days (recommended for Redis)
redis:
address: "localhost:6379"
password: ""
db: 0
key_prefix: "sr:"
Configuration examples:
- See
config/response-api/redis-simple.yamlfor basic standalone setup - See
config/response-api/redis-cluster.yamlfor cluster configuration - See
config/response-api/redis-production.yamlfor production with TLS
Standalone Redis Configuration
For simple deployments:
# config/config.yaml
response_api:
redis:
address: "localhost:6379"
db: 0
key_prefix: "sr:"
pool_size: 10
min_idle_conns: 2
max_retries: 3
dial_timeout: 5
read_timeout: 3
write_timeout: 3