Caching Configuration¶
Caching improves performance by storing analysis results.
Memory Cache (Default)¶
Redis Cache¶
For distributed deployments:
CacheConfig(
enabled=True,
backend="redis",
redis_url="redis://localhost:6379",
ttl=3600,
namespace="sentimatrix"
)
SQLite Cache¶
For persistent local caching:
CacheConfig(
enabled=True,
backend="sqlite",
sqlite_path=".cache/sentimatrix.db",
ttl=86400 # 24 hours
)
Cache Options¶
| Option | Description | Default |
|---|---|---|
enabled | Enable caching | True |
backend | Backend type | "memory" |
ttl | Time-to-live (seconds) | 3600 |
max_size | Max entries (memory) | 1000 |
compression | Compress values | False |
namespace | Key prefix | "sentimatrix" |
When to Use Each¶
| Backend | Use Case |
|---|---|
| Memory | Single process, development |
| Redis | Distributed, production |
| SQLite | Local persistence |