Performance
Optimize SoulCache for production use
Performance
SoulCache is designed for performance. Here are optimization strategies.
Bundle Size
SoulCache has zero runtime dependencies and a small bundle:
Tree Shaking
SoulCache supports tree shaking. Import only what you need:
Caching Strategies
TTL Caching
Configure the cache eviction lifetime. Background refetching and retry are internal modules targeted for future milestones.
Memory Management
Garbage Collection
Observer Cleanup
Network Optimization
Deduplication
Request Coalescing
Monitoring
Best Practices
- Set appropriate stale time — Balance freshness vs performance
- Use garbage collection — Prevent memory leaks
- Monitor metrics — Detect performance issues
- Optimize queries — Use selective queries
- Clean up subscriptions — Prevent memory leaks