Multi-Cache Manager
WordPress cache manager for Kinsta, Cloudflare and Perfmatters. One button for all of it.
by Milos Milosevic · github.com/mmilosevic87/cache-manager · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mmilosevic87/cache-manager/archive/refs/heads/main.zipA lightweight WordPress plugin that provides one-click cache management for Perfmatters, Kinsta hosting, and Cloudflare CDN, with automatic cache warming.
🚀 Features
- One-Button Cache Flush - Clear all cache layers with a single click
- Multi-System Support - Manages Perfmatters, Kinsta, and Cloudflare simultaneously
- Intelligent Delays - 3-second pauses between each flush to ensure completion
- Automatic Cache Warming - Pings configured URLs to regenerate fresh cache
- Error Handling - Comprehensive try-catch blocks prevent fatal errors
- Clean UI - Simple admin interface with AJAX-powered updates
- Zero Performance Impact - Only loads on admin settings page
📋 Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- At least one of the following:
- Perfmatters plugin (for CSS/JS optimization cache)
- Kinsta hosting (for server-level cache)
- Cloudflare WordPress plugin (for CDN cache)
🔧 Installation
Method 1: Manual Installation
- Download
multi-cache-manager.php - Upload to
/wp-content/plugins/multi-cache-manager/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings → Cache Manager
Method 2: Direct Upload
- Download the plugin file
- Go to Plugins → Add New → Upload Plugin
- Choose the file and click "Install Now"
- Activate the plugin
📖 Usage
Basic Usage
- Navigate to Settings → Cache Manager in WordPress admin
- Click the "Flush All Cache & Warm Up" button
- Wait ~15 seconds for completion
- Success message appears when done!
Configure Cache Warming URLs
- Go to Settings → Cache Manager
- Scroll to "Cache Warm-Up URLs" textarea
- Add URLs (one per line):
https://yourdomain.com/ https://yourdomain.com/about/ https://yourdomain.com/shop/ - Click "Save URLs"
- These pages will be pinged after cache flush
Recommended: Add up to 20 of your most important pages.
⚙️ What Gets Cleared
Perfmatters
- ✅ Used CSS files
- ✅ Minified JavaScript files
- ✅ Minified CSS files
- 📁 Location:
/wp-content/cache/perfmatters/
Kinsta Hosting
- ✅ Full-page cache (HTML)
- ✅ Object cache (Redis, if enabled)
- ✅ Edge cache (if enabled)
- 🔗 Method: Hits
/kinsta-clear-cache-all/endpoint
Cloudflare CDN
- ✅ Global CDN cache
- ✅ HTML, CSS, JS, images
- ✅ All edge locations worldwide
- 🔗 Method: Uses official Cloudflare plugin API
🔄 Process Flow
1. Perfmatters flush → ⏳ Wait 3 seconds
2. Kinsta flush → ⏳ Wait 3 seconds
3. Cloudflare flush → ⏳ Wait 3 seconds
4. Cache warming → ✅ Complete!
Total time: ~15 seconds
🎯 Technical Details
Cache Clearing Methods
Perfmatters:
Perfmatters\CSS::clear_used_css();
Perfmatters\Minify::clear_minified();
Kinsta:
wp_remote_get(home_url('/kinsta-clear-cache-all/'));
Cloudflare:
$cfHooks = new CF\WordPress\Hooks();
$cfHooks->purgeCacheEverything();
Security Features
- ✅ Permission checks (
manage_optionscapability required) - ✅ Nonce verification for AJAX requests
- ✅ URL validation and sanitization
- ✅ Try-catch blocks for error handling
- ✅ Class/function existence checks
Performance
- Frontend impact: 0% (plugin only runs in admin)
- Admin impact: Negligible (lightweight hook registration)
- Cache Manager page: ~1KB inline JS + 500 bytes CSS
- No external dependencies: All code is inline
🛡️ Error Handling
The plugin is designed to never cause fatal errors:
- ✅ Graceful degradation if a cache system is unavailable
- ✅ Continues processing even if one system fails
- ✅ Shows warning messages instead of breaking
- ✅ Multiple fallback methods for each cache system
Example Output
All systems working:
✓ All caches cleared and warmed up successfully!
Some systems unavailable:
⚠ Process completed with warnings. Check details below:
✓ Perfmatters cache cleared (Used CSS, Minified JS/CSS)
⚠ Kinsta cache plugin not found or unavailable
✓ Cloudflare cache cleared
✓ Cache warmed: 20/20 URLs pinged successfully
📊 Benefits
Before This Plugin
- Go to Perfmatters → Clear cache
- Go to Kinsta dashboard → Clear cache
- Go to Cloudflare plugin → Purge cache
- Manually visit pages to warm cache
- Total time: 5+ minutes
With This Plugin
- Click "Flush All Cache & Warm Up"
- Total time: 15 seconds
Time saved: 95% ⚡
❓ FAQ
Does this impact my site speed?
No. The plugin has zero impact on frontend performance. It only runs in WordPress admin, and even there, it only loads scripts on the Cache Manager settings page.
What if I don't have all three cache systems?
That's fine! The plugin detects which systems are available and only clears those. It will show warnings for unavailable systems but continues working.
Can I clear caches individually?
Currently, the plugin clears all available caches at once. Individual cache clearing may be added in a future version.
How many URLs should I add for cache warming?
We recommend 10-20 URLs of your most important pages (homepage, top posts, key landing pages, etc.).
Will this work with other cache plugins?
The plugin is specifically designed for Perfmatters, Kinsta, and Cloudflare. Other cache plugins are not supported.
Can I use this with WP-CLI?
Not currently. WP-CLI support may be added in a future version.
🐛 Troubleshooting
Button doesn't work
- Check browser console for errors (F12)
- Ensure you have
manage_optionscapability (admin role) - Try disabling other plugins temporarily
Cloudflare cache not clearing
- Ensure Cloudflare WordPress plugin is installed and activated
- Verify plugin is connected to your Cloudflare account
- Check if API credentials are valid
Kinsta cache not clearing
- Verify you're hosted on Kinsta
- Ensure Kinsta MU plugin is installed
- Check if
/kinsta-clear-cache-all/endpoint is accessible
📝 Changelog
Version 1.0.0
- Initial release
- Support for Perfmatters, Kinsta, and Cloudflare
- Automatic cache warming
- AJAX-powered UI
- Comprehensive error handling
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the GPL v2 or later.
👨💻 Author
Created for efficient cache management across multiple WordPress caching systems.
⭐ Support
If you find this plugin helpful, please consider:
- ⭐ Starring this repository
- 🐛 Reporting bugs via GitHub Issues
- 💡 Suggesting features via GitHub Issues
Made with ❤️ for WordPress performance optimization