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
Stale While Revalidate
Background Refetching
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