WP-CLI Integration Overview
ZiziCache provides comprehensive WP-CLI (WordPress Command Line Interface) support for managing cache, optimization, and system operations directly from the command line. This is essential for automated deployments, server maintenance, and development workflows.
Installation and Setup
Prerequisites
- WP-CLI installed: Ensure WP-CLI is available on your server
- ZiziCache activated: Plugin must be active in WordPress
- Proper permissions: User must have appropriate WordPress capabilities
- File access: Write permissions for cache directories
Verify CLI Access
Test ZiziCache CLI availability:
wp zizi-cache --help
This command displays all available ZiziCache CLI commands and options.
Cache Management Commands
Preload Cache
Generate cache files for all public pages:
wp zizi-cache preload-cache
Use Cases
- After content updates or site changes
- Following WordPress core or plugin updates
- Preparing for traffic spikes
- Automated deployment scripts
Process Details
- Crawls all public URLs on your site
- Generates optimized cache files
- Runs in background to avoid timeouts
- Respects cache exclusion rules
Purge Cache Commands
Purge Pages Only
wp zizi-cache purge-pages
Removes all cached page files while preserving other cache types.
Purge Pages and Preload
wp zizi-cache purge-pages-and-preload
Clears page cache and immediately starts preloading fresh content.
Purge Everything
wp zizi-cache purge-everything
Removes all cached content including pages, objects, and optimized assets.
Purge Everything and Preload
wp zizi-cache purge-everything-and-preload
Complete cache clear followed by comprehensive preloading.
Object Cache Management
Redis Cache Commands
Flush Redis Cache
wp zizi-cache redis-flush
Clears all Redis object cache data.
Alternative Redis Command
wp zizi-cache object-cache-flush
Alternative command for Redis cache clearing with additional safety checks.
Object Cache Benefits
- Improves database query performance
- Reduces server load during traffic spikes
- Essential for high-traffic websites
- Complements page caching effectively
OPcache Management
OPcache Flush Commands
Standard OPcache Flush
wp zizi-cache opcache-flush
Alternative OPcache Command
wp zizi-cache opcache/flush
When to Flush OPcache
- After plugin or theme updates
- Following WordPress core updates
- When deploying code changes
- Troubleshooting performance issues
OPcache Benefits
- Dramatically improves PHP performance
- Reduces server CPU usage
- Speeds up WordPress execution
- Essential for production environments
Quicklink Integration Commands
Enable Quicklink
wp zizi-cache quicklink-enable
Activates intelligent link prefetching for instant page navigation.
Disable Quicklink
wp zizi-cache quicklink-disable
Deactivates link prefetching functionality.
Check Quicklink Status
wp zizi-cache quicklink-status
Displays current Quicklink configuration and status.
Configure Quicklink
wp zizi-cache quicklink-configure
Interactive configuration for Quicklink settings and options.
Quicklink Benefits
- Instant page navigation experience
- Intelligent prefetching based on user behavior
- Respects user data preferences
- Improves perceived performance significantly
System Maintenance Commands
License Management
wp zizi-cache activate-license
Handles license activation for premium features (if applicable).
Permission Verification
ZiziCache CLI automatically verifies:
- Cache directory write permissions
- WordPress user capabilities
- File system access rights
- Server resource availability
Automated Deployment Integration
Deployment Script Example
#!/bin/bash # ZiziCache deployment automation # Clear all cache after deployment wp zizi-cache purge-everything # Flush OPcache for code changes wp zizi-cache opcache-flush # Flush object cache for database changes wp zizi-cache object-cache-flush # Preload cache for immediate performance wp zizi-cache preload-cache echo "ZiziCache optimization complete"
CI/CD Integration
Integrate with continuous deployment:
- GitHub Actions: Add cache management to workflows
- GitLab CI: Include cache commands in pipeline
- Jenkins: Automate cache operations in build process
- Custom scripts: Create tailored maintenance routines
Maintenance Automation
Cron Job Examples
Daily Cache Preload
# Daily at 2 AM 0 2 * * * cd /path/to/wordpress && wp zizi-cache preload-cache
Weekly Full Cache Clear
# Sunday at 3 AM 0 3 * * 0 cd /path/to/wordpress && wp zizi-cache purge-everything-and-preload
OPcache Maintenance
# Every 6 hours 0 */6 * * * cd /path/to/wordpress && wp zizi-cache opcache-flush
Monitoring Integration
Combine CLI commands with monitoring:
- Log command outputs for tracking
- Send notifications on command completion
- Monitor cache hit rates after operations
- Track performance improvements
Development Workflow Integration
Local Development
# Clear cache during development wp zizi-cache purge-everything # Disable cache for debugging wp zizi-cache purge-everything # (Then disable cache in WordPress admin)
Staging Environment
# Prepare staging for testing wp zizi-cache purge-everything wp zizi-cache preload-cache wp zizi-cache quicklink-enable
Production Deployment
# Production optimization sequence wp zizi-cache opcache-flush wp zizi-cache object-cache-flush wp zizi-cache purge-everything-and-preload
Error Handling and Troubleshooting
Common CLI Issues
Permission Errors
- Check user permissions: Ensure proper WordPress capabilities
- File system access: Verify cache directory permissions
- Server configuration: Check PHP execution limits
Command Not Found
- Plugin activation: Ensure ZiziCache is active
- WP-CLI installation: Verify WP-CLI is properly installed
- WordPress path: Run commands from WordPress root directory
Timeout Issues
- Large sites: Preload operations may take time
- Background processing: Commands run asynchronously when possible
- Monitor progress: Check log files for operation status
Debug Mode
Enable verbose output for troubleshooting:
wp zizi-cache preload-cache --debug
Provides detailed information about command execution and any issues encountered.
Performance Optimization Workflows
Site Launch Preparation
- Configure ZiziCache settings in WordPress admin
- Run comprehensive cache preload:
wp zizi-cache preload-cache - Enable Quicklink:
wp zizi-cache quicklink-enable - Verify cache performance with testing tools
Content Update Workflow
- Make content changes in WordPress
- Clear relevant cache:
wp zizi-cache purge-pages - Preload updated content:
wp zizi-cache preload-cache - Test site functionality and performance
System Maintenance Routine
- Weekly full cache clear:
wp zizi-cache purge-everything - OPcache flush:
wp zizi-cache opcache-flush - Object cache clear:
wp zizi-cache object-cache-flush - Comprehensive preload:
wp zizi-cache preload-cache - Performance monitoring and verification
Best Practices for CLI Usage
Security Considerations
- User permissions: Only grant CLI access to trusted users
- Script security: Secure deployment and maintenance scripts
- Log monitoring: Monitor CLI command execution logs
- Access control: Restrict CLI access in production environments
Performance Guidelines
- Off-peak execution: Run intensive operations during low traffic
- Resource monitoring: Monitor server resources during operations
- Gradual implementation: Test CLI workflows in staging first
- Documentation: Document custom CLI workflows and schedules
ZiziCache WP-CLI commands provide powerful automation capabilities for cache management and performance optimization. Integrate these commands into your development and maintenance workflows to ensure optimal website performance and streamlined operations.