Available Commands
cache:clear
Clear all application caches
cache:warmup
Pre-warm the cache for better startup
cache:clear
Clears all cached data including service container cache, command registry, and in-memory caches.Usage
What Gets Cleared
The command clears multiple cache components:- Service Cache Files - Cached service definitions
- Command Cache - Command registry cache
- Memory Caches - Resolution and module scan caches
- Service Instances - Resets singleton instances (except essential services)
- Scan Status - Resets module and source scan flags
Example Output
Cache Files Cleared
The command removes these cache files:When to Clear Cache
Clear cache when:- After adding new services - Ensure new services are discovered
- After modifying decorators - Refresh service metadata
- Debugging DI issues - Reset container state
- After dependency changes - Clear stale dependencies
- Deployment issues - Reset to clean state
- Performance degradation - Remove corrupted cache
Essential Services
These services are preserved during cache clear:- Settings - Application configuration
- Logger - Logging service
- Config - Configuration loader
cache:warmup
Pre-warms the cache by forcing service discovery, pre-loading essential services, and generating cache files.Usage
What Gets Warmed
The command performs these operations:- Service Discovery - Scans and registers all services
- Essential Service Loading - Pre-loads critical services
- Cache Generation - Creates optimized cache files
- Cache Validation - Verifies cache integrity
Example Output
Essential Services Tagged
Services tagged for pre-loading:essential- Core framework servicescontroller- All controllerssecurity- Authentication/authorizationorm- Database and entity managerslogging- Logging infrastructure
Common Pre-loaded Services
When to Warm Cache
Warm cache:- Before deployment - Optimize production startup
- After clearing cache - Rebuild immediately
- CI/CD pipeline - Build cache during deployment
- Performance testing - Ensure consistent timing
- Production startup - Reduce first-request latency
Cache Validation
The warmup validates cache integrity:Cache Validation Checks
Cache Validation Checks
- File Exists - Cache file is present
- Valid JSON - Cache is properly formatted
- Required Keys - Contains version, timestamp, services
- Valid Structure - Services array is properly formatted
- Service Metadata - Each service has name, class_path, module
Validation Output
Valid Cache:Performance Impact
Startup Time Comparison
| Scenario | First Request | Subsequent Requests |
|---|---|---|
| No Cache | 800-1200ms | 800-1200ms |
| Cold Cache | 600-800ms | 100-200ms |
| Warm Cache | 100-200ms | 50-100ms |
Cache Benefits
Cache Location
Cache files are stored in:- Created automatically during
framefox init - Excluded from git via
.gitignore - Cleared on
cache:clear - Regenerated on
cache:warmupor server start
Best Practices
Development Workflow
Deployment Workflow
Troubleshooting Checklist
Cache Debug Mode
Enable cache debugging in configuration:Common Issues
Service Not Found After Adding
Slow Startup in Production
Cache Validation Fails
Environment-Specific Caching
Different cache files for different environments:- Development:
dev_services.json(with debug info) - Production:
services.json(optimized)
APP_ENV:
Next Steps
Debug Commands
Debug your application
Performance
Optimize performance