« Back to Add-on Library
Cache Manager
The Cache Manager snippet provides powerful utilities for managing WordPress transient caches used throughout CWP Snippets. It includes wildcard-based cache clearing, efficient bulk deletion with configurable limits, and safe database operations perfect for managing large numbers of cached items.
### Key Features
- Wildcard Cache Clearing - Delete transients matching a prefix pattern
- Efficient Bulk Operations - Process large numbers of transients with configurable limits
- Capability Checks - Built-in security with WordPress capability verification
- Safe Queries - Proper database escaping and prepared statements
- Safe Characters - Input validation prevents malicious prefix patterns
- Helper Functions - Global functions for easy cache management from anywhere
### Capabilities
- Prefix-Based Deletion - Clear all transients starting with a specific prefix
- Limit Control - Set maximum rows to examine/delete per operation
- Return Reporting - Get list of deleted keys for logging
- Multi-Site Support - Works with both regular and site transients
- Status Reporting - Returns count and details of cleared transients
### Requirements
✓ CWP Snippets Pro plugin installed on WordPress
✓ WordPress 5.8 or higher
✓ PHP 7.4 or higher
### Security Features
- Capability checking (manage_options required)
- Prefix validation (alphanumeric, underscore, hyphen only)
- Prepared database statements
- Safe escaping of LIKE patterns
- No direct eval or dynamic code
### Ideal For
- Clearing plugin caches during development
- Bulk cache management in admin workflows
- Troubleshooting cache-related issues
- Automating cache cleanup processes
### What's Included
✓ `cwpClearCacheWildcard()` helper function
✓ Database-safe operations with prepared statements
✓ Configurable deletion limits
✓ Deleted items reporting
✓ Input validation and security checks
---
Essential utility for CWP Snippets developers managing transient caches in WordPress.
### Key Features
- Wildcard Cache Clearing - Delete transients matching a prefix pattern
- Efficient Bulk Operations - Process large numbers of transients with configurable limits
- Capability Checks - Built-in security with WordPress capability verification
- Safe Queries - Proper database escaping and prepared statements
- Safe Characters - Input validation prevents malicious prefix patterns
- Helper Functions - Global functions for easy cache management from anywhere
### Capabilities
- Prefix-Based Deletion - Clear all transients starting with a specific prefix
- Limit Control - Set maximum rows to examine/delete per operation
- Return Reporting - Get list of deleted keys for logging
- Multi-Site Support - Works with both regular and site transients
- Status Reporting - Returns count and details of cleared transients
### Requirements
✓ CWP Snippets Pro plugin installed on WordPress
✓ WordPress 5.8 or higher
✓ PHP 7.4 or higher
### Security Features
- Capability checking (manage_options required)
- Prefix validation (alphanumeric, underscore, hyphen only)
- Prepared database statements
- Safe escaping of LIKE patterns
- No direct eval or dynamic code
### Ideal For
- Clearing plugin caches during development
- Bulk cache management in admin workflows
- Troubleshooting cache-related issues
- Automating cache cleanup processes
### What's Included
✓ `cwpClearCacheWildcard()` helper function
✓ Database-safe operations with prepared statements
✓ Configurable deletion limits
✓ Deleted items reporting
✓ Input validation and security checks
---
Essential utility for CWP Snippets developers managing transient caches in WordPress.
Downloads
- Download v1.0.0 cache-manager-1.0.0.zip